1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Refs #26022 -- Used context manager version of assertRaisesMessage in tests.

Follow up to 253adc2b8a.
This commit is contained in:
Jon Dufresne
2019-04-28 06:15:19 -07:00
committed by Mariusz Felisiak
parent dbe436a9a9
commit 5627057f63
3 changed files with 10 additions and 10 deletions

View File

@@ -34,11 +34,11 @@ class M2MRegressionTests(TestCase):
def test_internal_related_name_not_in_error_msg(self):
# The secret internal related names for self-referential many-to-many
# fields shouldn't appear in the list when an error is made.
self.assertRaisesMessage(
with self.assertRaisesMessage(
FieldError,
"Choices are: id, name, references, related, selfreferchild, selfreferchildsibling",
lambda: SelfRefer.objects.filter(porcupine='fred')
)
):
SelfRefer.objects.filter(porcupine='fred')
def test_m2m_inheritance_symmetry(self):
# Test to ensure that the relationship between two inherited models