1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.

This commit is contained in:
Hasan
2016-01-18 12:15:45 +03:30
committed by Tim Graham
parent 253adc2b8a
commit 26ad01719d
23 changed files with 124 additions and 221 deletions

View File

@@ -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.