mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #26022 -- Used context manager version of assertRaisesMessage in tests.
Follow up to 253adc2b8a.
This commit is contained in:
committed by
Mariusz Felisiak
parent
dbe436a9a9
commit
5627057f63
@@ -89,14 +89,12 @@ class DatesTests(TestCase):
|
||||
Article.objects.dates()
|
||||
|
||||
def test_dates_fails_when_given_invalid_field_argument(self):
|
||||
self.assertRaisesMessage(
|
||||
with self.assertRaisesMessage(
|
||||
FieldError,
|
||||
"Cannot resolve keyword 'invalid_field' into field. Choices are: "
|
||||
"categories, comments, id, pub_date, pub_datetime, title",
|
||||
Article.objects.dates,
|
||||
"invalid_field",
|
||||
"year",
|
||||
)
|
||||
):
|
||||
Article.objects.dates('invalid_field', 'year')
|
||||
|
||||
def test_dates_fails_when_given_invalid_kind_argument(self):
|
||||
msg = "'kind' must be one of 'year', 'month', 'week', or 'day'."
|
||||
|
||||
Reference in New Issue
Block a user