diff options
| author | Clifford Gama <53076065+cliff688@users.noreply.github.com> | 2025-05-27 23:20:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-27 18:20:07 -0300 |
| commit | ad28db666e0884b658f5e240c3d7ee1362688ba1 (patch) | |
| tree | 2d6f629f9931747fe902effd607bccac51f5ffce /tests/test_utils | |
| parent | e29272bbbd86a1c975e04e643e860aa3e0d58252 (diff) | |
Removed redundant redefinition of variable in tests/test_utils/tests.py.
Diffstat (limited to 'tests/test_utils')
| -rw-r--r-- | tests/test_utils/tests.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 16692500e3..fd0c47a42c 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -517,7 +517,7 @@ class AssertTemplateUsedContextManagerTests(SimpleTestCase): with self.assertTemplateNotUsed("template_used/alternative.html"): pass - def test_error_message(self): + def test_error_message_no_template_used(self): msg = "No templates used to render the response" with self.assertRaisesMessage(AssertionError, msg): with self.assertTemplateUsed("template_used/base.html"): @@ -527,15 +527,6 @@ class AssertTemplateUsedContextManagerTests(SimpleTestCase): with self.assertTemplateUsed(template_name="template_used/base.html"): pass - msg2 = ( - "Template 'template_used/base.html' was not a template used to render " - "the response. Actual template(s) used: template_used/alternative.html" - ) - with self.assertRaisesMessage(AssertionError, msg2): - with self.assertTemplateUsed("template_used/base.html"): - render_to_string("template_used/alternative.html") - - msg = "No templates used to render the response" with self.assertRaisesMessage(AssertionError, msg): response = self.client.get("/test_utils/no_template_used/") self.assertTemplateUsed(response, "template_used/base.html") @@ -549,6 +540,15 @@ class AssertTemplateUsedContextManagerTests(SimpleTestCase): template = Template("template_used/alternative.html", name=None) template.render(Context()) + def test_error_message_unexpected_template_used(self): + msg = ( + "Template 'template_used/base.html' was not a template used to render " + "the response. Actual template(s) used: template_used/alternative.html" + ) + with self.assertRaisesMessage(AssertionError, msg): + with self.assertTemplateUsed("template_used/base.html"): + render_to_string("template_used/alternative.html") + def test_msg_prefix(self): msg_prefix = "Prefix" msg = f"{msg_prefix}: No templates used to render the response" |
