Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.

This commit is contained in:
Hasan 2016-01-18 12:15:45 +03:30 committed by Tim Graham
parent 253adc2b8a
commit 26ad01719d
23 changed files with 124 additions and 221 deletions

View file

@ -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):