class test_IntVar(unittest.TestCase): """ verify functionality of the IntVar variable class """ def setUp(self): self.ivar = IntVar('name', 'description') def testValidation(self): """ an IntVar should take values that can be cast to an integer, any other value should raise a ValidationException """ self.assertEqual(1, self.ivar.validate(1)) self.assertEqual(1, self.ivar.validate(1.9)) self.assertEqual(1, self.ivar.validate('1')) self.assertRaises(ValidationException, self.ivar.validate, 'one')
def setUp(self): self.ivar = IntVar('name', 'description')