示例#1
0
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')
示例#2
0
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')
示例#3
0
 def setUp(self):
     self.ivar = IntVar('name', 'description')
示例#4
0
 def setUp(self):
     self.ivar = IntVar('name', 'description')