from Tkinter import *
import calc
import unittest

calcinst = calc.App(Tk())

class DigitTest(unittest.TestCase):
    def testDigBtns(self):
        """C + num ==> num for all num"""
        self.DigitBtns = calcinst.btnDigits
        for btn in self.DigitBtns:
            calcinst.btnCClick()
            # Here, invoke() does not work since
            # the callback is bound to an event, and was not
            # specified using the "command" option
            e = Event()
            e.widget = btn
            calcinst.btnDigitClick(e)
            self.assertEqual(calcinst.display.get(), btn.cget("text"))

if __name__ == '__main__':
    unittest.main()