From 23ac4ade910b664f3fbb9fd634da6a8a32b620c7 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Wed, 22 Jul 2020 21:14:34 -0700 Subject: [PATCH] Add specific failing string detail to datetime format test (#148) --- babybuddy/tests/tests_formats.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/babybuddy/tests/tests_formats.py b/babybuddy/tests/tests_formats.py index 6cc7a153..8089bc59 100644 --- a/babybuddy/tests/tests_formats.py +++ b/babybuddy/tests/tests_formats.py @@ -17,8 +17,11 @@ class FormatsTestCase(TestCase): ] for example in supported_custom_examples: - result = field.to_python(example) - self.assertIsInstance(result, datetime.datetime) + try: + result = field.to_python(example) + self.assertIsInstance(result, datetime.datetime) + except ValidationError: + self.fail('Format of "{}" not recognized!'.format(example)) with self.assertRaises(ValidationError): field.to_python('invalid date string!')