Add specific failing string detail to datetime format test (#148)

This commit is contained in:
Christopher C. Wells 2020-07-22 21:14:34 -07:00
parent d138558158
commit 23ac4ade91
1 changed files with 5 additions and 2 deletions

View File

@ -17,8 +17,11 @@ class FormatsTestCase(TestCase):
] ]
for example in supported_custom_examples: for example in supported_custom_examples:
result = field.to_python(example) try:
self.assertIsInstance(result, datetime.datetime) result = field.to_python(example)
self.assertIsInstance(result, datetime.datetime)
except ValidationError:
self.fail('Format of "{}" not recognized!'.format(example))
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
field.to_python('invalid date string!') field.to_python('invalid date string!')