From 26ad01719d73823e65c0358a2ee9941e0a888a63 Mon Sep 17 00:00:00 2001 From: Hasan Date: Mon, 18 Jan 2016 12:15:45 +0330 Subject: Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate. --- tests/inline_formsets/tests.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'tests/inline_formsets') 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. -- cgit v1.3