mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.
This commit is contained in:
parent
253adc2b8a
commit
26ad01719d
23 changed files with 124 additions and 221 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue