diff options
author | Hasan <hasan.r67@gmail.com> | 2016-01-18 12:15:45 +0330 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-01-29 13:37:33 -0500 |
commit | 26ad01719d73823e65c0358a2ee9941e0a888a63 (patch) | |
tree | 9e458f4c3428400e0970554ce19f6ed02e862a3b /tests/inline_formsets | |
parent | 253adc2b8a52982139d40c4f55b3fd446e1cb8f3 (diff) | |
download | django-26ad01719d73823e65c0358a2ee9941e0a888a63.tar.gz |
Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.
Diffstat (limited to 'tests/inline_formsets')
-rw-r--r-- | tests/inline_formsets/tests.py | 16 |
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. |