diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-02-04 21:58:07 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-02-07 12:46:23 +0100 |
| commit | fc4f45ebdccd87f140f39bebed897053c7f345c5 (patch) | |
| tree | 0080670fe0c04124b7b2e15766fac2d73a00f164 /tests/template_tests | |
| parent | 71756bdfed5029bd14dce8cb3c5629efc4be55ac (diff) | |
Used assertRaisesMessage() in various tests.
Diffstat (limited to 'tests/template_tests')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_include.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/template_tests/syntax_tests/test_include.py b/tests/template_tests/syntax_tests/test_include.py index 8587639674..b840c676f7 100644 --- a/tests/template_tests/syntax_tests/test_include.py +++ b/tests/template_tests/syntax_tests/test_include.py @@ -201,9 +201,8 @@ class IncludeTests(SimpleTestCase): """ engine = Engine(app_dirs=True, debug=True) template = engine.get_template('test_include_error.html') - with self.assertRaises(TemplateDoesNotExist) as e: + with self.assertRaisesMessage(TemplateDoesNotExist, 'missing.html'): template.render(Context()) - self.assertEqual(e.exception.args[0], 'missing.html') def test_extends_include_missing_baseloader(self): """ @@ -213,9 +212,8 @@ class IncludeTests(SimpleTestCase): """ engine = Engine(app_dirs=True, debug=True) template = engine.get_template('test_extends_error.html') - with self.assertRaises(TemplateDoesNotExist) as e: + with self.assertRaisesMessage(TemplateDoesNotExist, 'missing.html'): template.render(Context()) - self.assertEqual(e.exception.args[0], 'missing.html') def test_extends_include_missing_cachedloader(self): engine = Engine(debug=True, loaders=[ @@ -225,15 +223,13 @@ class IncludeTests(SimpleTestCase): ]) template = engine.get_template('test_extends_error.html') - with self.assertRaises(TemplateDoesNotExist) as e: + with self.assertRaisesMessage(TemplateDoesNotExist, 'missing.html'): template.render(Context()) - self.assertEqual(e.exception.args[0], 'missing.html') # Repeat to ensure it still works when loading from the cache template = engine.get_template('test_extends_error.html') - with self.assertRaises(TemplateDoesNotExist) as e: + with self.assertRaisesMessage(TemplateDoesNotExist, 'missing.html'): template.render(Context()) - self.assertEqual(e.exception.args[0], 'missing.html') def test_include_template_argument(self): """ |
