summaryrefslogtreecommitdiff
path: root/tests/inline_formsets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/inline_formsets')
-rw-r--r--tests/inline_formsets/tests.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/inline_formsets/tests.py b/tests/inline_formsets/tests.py
index 3bb7586575..c298f9430e 100644
--- a/tests/inline_formsets/tests.py
+++ b/tests/inline_formsets/tests.py
@@ -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.