mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.
This commit is contained in:
@@ -123,12 +123,9 @@ class InlineFormsetFactoryTest(TestCase):
|
||||
Child has two ForeignKeys to Parent, so if we don't specify which one
|
||||
to use for the inline formset, we should get an exception.
|
||||
"""
|
||||
six.assertRaisesRegex(
|
||||
self,
|
||||
ValueError,
|
||||
"'inline_formsets.Child' has more than one ForeignKey to 'inline_formsets.Parent'.",
|
||||
inlineformset_factory, Parent, Child
|
||||
)
|
||||
msg = "'inline_formsets.Child' has more than one ForeignKey to 'inline_formsets.Parent'."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
inlineformset_factory(Parent, Child)
|
||||
|
||||
def test_fk_name_not_foreign_key_field_from_child(self):
|
||||
"""
|
||||
@@ -144,11 +141,8 @@ class InlineFormsetFactoryTest(TestCase):
|
||||
If the field specified in fk_name is not a ForeignKey, we should get an
|
||||
exception.
|
||||
"""
|
||||
six.assertRaisesRegex(
|
||||
self, ValueError,
|
||||
"'inline_formsets.Child' has no field named 'test'.",
|
||||
inlineformset_factory, Parent, Child, fk_name='test'
|
||||
)
|
||||
with self.assertRaisesMessage(ValueError, "'inline_formsets.Child' has no field named 'test'."):
|
||||
inlineformset_factory(Parent, Child, fk_name='test')
|
||||
|
||||
def test_any_iterable_allowed_as_argument_to_exclude(self):
|
||||
# Regression test for #9171.
|
||||
|
||||
Reference in New Issue
Block a user