Brak opisu
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_datetime.py 839B

12345678910111213141516171819202122232425
  1. import unittest
  2. from lodel.leapi.datahandlers.datas import DateTime
  3. class DatetimeTestCase(unittest.TestCase):
  4. def test_datetime_check_data_value(self):
  5. test_datetime = DateTime()
  6. test_value = '2016-01-01'
  7. _, error = test_datetime.check_data_value(test_value)
  8. self.assertIsNone(error)
  9. def test_datetime_check_data_value_with_custom_format(self):
  10. test_value = '2016-01-01T10:20:30Z'
  11. test_datetime = DateTime(format='%Y-%m-%dT%H:%M:%SZ')
  12. _, error = test_datetime.check_data_value(test_value)
  13. self.assertIsNone(error)
  14. def test_check_bad_value(self):
  15. test_datetime = DateTime(now_on_create=True, now_on_update=True)
  16. test_value = '2016-01-01-test'
  17. _, error = test_datetime.check_data_value(test_value)
  18. self.assertIsNotNone(error)