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_varchar.py 804B

123456789101112131415161718192021222324252627
  1. import unittest
  2. from lodel.leapi.datahandlers.datas import Varchar, Integer
  3. class VarcharTestCase(unittest.TestCase):
  4. def test_check_data_value(self):
  5. test_varchar = Varchar(max_length=10)
  6. _, error = test_varchar.check_data_value("c" * 10)
  7. self.assertIsNone(error)
  8. _, error = test_varchar.check_data_value("c" * 9)
  9. self.assertIsNone(error)
  10. _, error = test_varchar.check_data_value("c" * 11)
  11. self.assertIsNotNone(error)
  12. self.assertIsInstance(error, ValueError)
  13. def test_can_override(self):
  14. test_varchar1 = Varchar()
  15. test_integer = Integer()
  16. test_varchar2 = Varchar()
  17. self.assertFalse(test_varchar1.can_override(test_integer))
  18. self.assertTrue(test_varchar1.can_override(test_varchar2))