def test_base(self): value = datetime.now() field = DateTimeField() value_to_db = field.to_db(value) value_to_python = field.to_python(value_to_db) self.assertIsInstance(value_to_db, str) self.assertIsInstance(value_to_python, datetime) self.assertEqual(value_to_python, value)
def test_fail_on_invalid_type(self): value = {} field = DateTimeField() with self.assertRaises(ValidationError): field.validate(value)