Esempio n. 1
0
 def test_boolean_raises_ValueError(self):
     for b in ["", None, 1, 0, True, False, [None], {True: True}]:
         with self.assertRaises(ValueError):
             validatorfuncs.boolean(b)
Esempio n. 2
0
 def validate(self, value, **kwargs):
     return validatorfuncs.boolean(value, option_key=self.key, **kwargs)
Esempio n. 3
0
 def test_boolean(self):
     for b in ["true", "1", "on", "ENABLED"]:
         self.assertTrue(validatorfuncs.boolean(b))
     for b in ["FalSe", "0", "oFF", "disabled"]:
         self.assertFalse(validatorfuncs.boolean(b))
Esempio n. 4
0
 def test_boolean(self):
     for b in ['true', '1', 'on', 'ENABLED']:
         self.assertTrue(validatorfuncs.boolean(b))
     for b in ['FalSe', '0', 'oFF', 'disabled']:
         self.assertFalse(validatorfuncs.boolean(b))