class test_OnOffVar(unittest.TestCase): """ verify functionality of the OnOffVar variable class """ def setUp(self): self.ovar = OnOffVar('name', 'description') def testValidation(self): """ check to see that various inputs result in a Boolean Value """ for val in ('f', 'F', 'n', 'N', 'false', 0, 'off'): self.assertEqual(self.ovar.validate(val), 'off') for val in ('t', 'T', 'y', 'Y', 'true', 1, 'on'): self.assertEqual(self.ovar.validate(val), 'on') self.assertRaises(ValidationException, self.ovar.validate, 'lunchbox')
def setUp(self): self.ovar = OnOffVar('name', 'description')