No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_boolean.py 840B

1234567891011121314151617181920212223242526
  1. import unittest
  2. from lodel.exceptions import *
  3. from lodel.leapi.datahandlers.datas import Boolean, Varchar, Integer
  4. test_boolean = Boolean()
  5. class BooleanTestCase(unittest.TestCase):
  6. def test_boolean_good_check_data_value(self):
  7. for test_value in [True, False]:
  8. value = test_boolean._check_data_value(test_value)
  9. self.assertEqual(value, bool(test_value))
  10. def test_boolean_bad_check_data_value(self):
  11. for test_value in ['ok', 'True', 'False']:
  12. with self.assertRaises(FieldValidationError):
  13. test_boolean._check_data_value(test_value)
  14. def test_can_override(self):
  15. test_varchar = Varchar()
  16. test_int = Integer()
  17. self.assertFalse(test_boolean.can_override(test_varchar))
  18. self.assertFalse(test_boolean.can_override(test_int))