summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_exceptions.py
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2022-02-08 12:09:55 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-08 12:15:38 +0100
commit6a682b38e75d4c975b4c4493565a59f1bc14397c (patch)
tree0bd9cda550bea26238656d9f120d769e8b41bb9e /tests/template_tests/syntax_tests/test_exceptions.py
parente73ce08888e6f34d3f050377cfd2fbb733be94a9 (diff)
[4.0.x] Refs #33476 -- Reformatted code with Black.
Backport of 9c19aff7c7561e3a82978a272ecdaad40dda5c00 from main.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_exceptions.py')
-rw-r--r--tests/template_tests/syntax_tests/test_exceptions.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/tests/template_tests/syntax_tests/test_exceptions.py b/tests/template_tests/syntax_tests/test_exceptions.py
index db1e0f9f5f..7000b45afd 100644
--- a/tests/template_tests/syntax_tests/test_exceptions.py
+++ b/tests/template_tests/syntax_tests/test_exceptions.py
@@ -6,30 +6,31 @@ from .test_extends import inheritance_templates
class ExceptionsTests(SimpleTestCase):
-
- @setup({'exception01': "{% extends 'nonexistent' %}"})
+ @setup({"exception01": "{% extends 'nonexistent' %}"})
def test_exception01(self):
"""
Raise exception for invalid template name
"""
with self.assertRaises(TemplateDoesNotExist):
- self.engine.render_to_string('exception01')
+ self.engine.render_to_string("exception01")
- @setup({'exception02': '{% extends nonexistent %}'})
+ @setup({"exception02": "{% extends nonexistent %}"})
def test_exception02(self):
"""
Raise exception for invalid variable template name
"""
if self.engine.string_if_invalid:
with self.assertRaises(TemplateDoesNotExist):
- self.engine.render_to_string('exception02')
+ self.engine.render_to_string("exception02")
else:
with self.assertRaises(TemplateSyntaxError):
- self.engine.render_to_string('exception02')
+ self.engine.render_to_string("exception02")
@setup(
- {'exception03': "{% extends 'inheritance01' %}"
- "{% block first %}2{% endblock %}{% extends 'inheritance16' %}"},
+ {
+ "exception03": "{% extends 'inheritance01' %}"
+ "{% block first %}2{% endblock %}{% extends 'inheritance16' %}"
+ },
inheritance_templates,
)
def test_exception03(self):
@@ -37,10 +38,12 @@ class ExceptionsTests(SimpleTestCase):
Raise exception for extra {% extends %} tags
"""
with self.assertRaises(TemplateSyntaxError):
- self.engine.get_template('exception03')
+ self.engine.get_template("exception03")
@setup(
- {'exception04': "{% extends 'inheritance17' %}{% block first %}{% echo 400 %}5678{% endblock %}"},
+ {
+ "exception04": "{% extends 'inheritance17' %}{% block first %}{% echo 400 %}5678{% endblock %}"
+ },
inheritance_templates,
)
def test_exception04(self):
@@ -48,12 +51,12 @@ class ExceptionsTests(SimpleTestCase):
Raise exception for custom tags used in child with {% load %} tag in parent, not in child
"""
with self.assertRaises(TemplateSyntaxError):
- self.engine.get_template('exception04')
+ self.engine.get_template("exception04")
- @setup({'exception05': '{% block first %}{{ block.super }}{% endblock %}'})
+ @setup({"exception05": "{% block first %}{{ block.super }}{% endblock %}"})
def test_exception05(self):
"""
Raise exception for block.super used in base template
"""
with self.assertRaises(TemplateSyntaxError):
- self.engine.render_to_string('exception05')
+ self.engine.render_to_string("exception05")