diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-02-10 11:31:47 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-02-10 11:31:47 +0000 |
| commit | 8be356ea99489e932174f7c1d54d2ff766a52311 (patch) | |
| tree | aa4dea4311dd7e7363097de9c19f1f656ab5d5ac | |
| parent | ad8022f89a515521f7de5e22503a1df31974fc23 (diff) | |
Fixed #17640 -- Avoided a DeprecationWarning in the test suite. Thanks zsiciarz and claudep.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17492 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | tests/regressiontests/test_utils/tests.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py index 72a815423d..7f4208c0e1 100644 --- a/tests/regressiontests/test_utils/tests.py +++ b/tests/regressiontests/test_utils/tests.py @@ -136,24 +136,17 @@ class AssertTemplateUsedContextManagerTests(TestCase): pass def test_error_message(self): - try: + with self.assertRaisesRegexp(AssertionError, r'^template_used/base\.html'): with self.assertTemplateUsed('template_used/base.html'): pass - except AssertionError, e: - self.assertTrue('template_used/base.html' in e.message) - try: + with self.assertRaisesRegexp(AssertionError, r'^template_used/base\.html'): with self.assertTemplateUsed(template_name='template_used/base.html'): pass - except AssertionError, e: - self.assertTrue('template_used/base.html' in e.message) - try: + with self.assertRaisesRegexp(AssertionError, r'^template_used/base\.html.*template_used/alternative\.html$'): with self.assertTemplateUsed('template_used/base.html'): render_to_string('template_used/alternative.html') - except AssertionError, e: - self.assertTrue('template_used/base.html' in e.message, e.message) - self.assertTrue('template_used/alternative.html' in e.message, e.message) def test_failure(self): with self.assertRaises(TypeError): |
