diff options
Diffstat (limited to 'tests/dates/tests.py')
-rw-r--r-- | tests/dates/tests.py | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/tests/dates/tests.py b/tests/dates/tests.py index 97c4face6e..5d7bd0fb97 100644 --- a/tests/dates/tests.py +++ b/tests/dates/tests.py @@ -102,25 +102,12 @@ class DatesTests(TestCase): ) def test_dates_fails_when_given_invalid_kind_argument(self): - six.assertRaisesRegex( - self, - AssertionError, - "'kind' must be one of 'year', 'month' or 'day'.", - Article.objects.dates, - "pub_date", - "bad_kind", - ) + with self.assertRaisesMessage(AssertionError, "'kind' must be one of 'year', 'month' or 'day'."): + Article.objects.dates("pub_date", "bad_kind") def test_dates_fails_when_given_invalid_order_argument(self): - six.assertRaisesRegex( - self, - AssertionError, - "'order' must be either 'ASC' or 'DESC'.", - Article.objects.dates, - "pub_date", - "year", - order="bad order", - ) + with self.assertRaisesMessage(AssertionError, "'order' must be either 'ASC' or 'DESC'."): + Article.objects.dates("pub_date", "year", order="bad order") @override_settings(USE_TZ=False) def test_dates_trunc_datetime_fields(self): |