diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-10-17 16:09:07 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-10-17 16:09:07 +0000 |
| commit | 55d8c47d29ce24428fbfd425a5ae6030bbeaf09f (patch) | |
| tree | 076fa401cedf36524d286a98c3840740139fb775 /tests/regressiontests/inline_formsets | |
| parent | 630b1fc09b6a1e521b64bc7f8792fd0807d22c07 (diff) | |
[1.2.X] Fixed a few other backporting-related bugs introduced in r14213.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14247 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/inline_formsets')
| -rw-r--r-- | tests/regressiontests/inline_formsets/tests.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/regressiontests/inline_formsets/tests.py b/tests/regressiontests/inline_formsets/tests.py index 24488661c7..73bbeebbf7 100644 --- a/tests/regressiontests/inline_formsets/tests.py +++ b/tests/regressiontests/inline_formsets/tests.py @@ -107,6 +107,13 @@ class DeletionTests(TestCase): class InlineFormsetFactoryTest(TestCase): + def assertRaisesErrorWithMessage(self, error, message, callable, *args, **kwargs): + self.assertRaises(error, callable, *args, **kwargs) + try: + callable(*args, **kwargs) + except error, e: + self.assertEqual(message, str(e)) + def test_inline_formset_factory(self): """ These should both work without a problem. @@ -119,7 +126,7 @@ 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. """ - self.assertRaisesRegexp(Exception, + self.assertRaisesErrorWithMessage(Exception, "<class 'regressiontests.inline_formsets.models.Child'> has more than 1 ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>", inlineformset_factory, Parent, Child ) @@ -129,7 +136,7 @@ class InlineFormsetFactoryTest(TestCase): If we specify fk_name, but it isn't a ForeignKey from the child model to the parent model, we should get an exception. """ - self.assertRaises(Exception, + self.assertRaisesErrorWithMessage(Exception, "fk_name 'school' is not a ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>", inlineformset_factory, Parent, Child, fk_name='school' ) @@ -139,7 +146,7 @@ class InlineFormsetFactoryTest(TestCase): If the field specified in fk_name is not a ForeignKey, we should get an exception. """ - self.assertRaisesRegexp(Exception, + self.assertRaisesErrorWithMessage(Exception, "<class 'regressiontests.inline_formsets.models.Child'> has no field named 'test'", inlineformset_factory, Parent, Child, fk_name='test' ) |
