summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_load.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_load.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_load.py')
-rw-r--r--tests/template_tests/syntax_tests/test_load.py76
1 files changed, 44 insertions, 32 deletions
diff --git a/tests/template_tests/syntax_tests/test_load.py b/tests/template_tests/syntax_tests/test_load.py
index 919bbf1346..ae5f1d4b48 100644
--- a/tests/template_tests/syntax_tests/test_load.py
+++ b/tests/template_tests/syntax_tests/test_load.py
@@ -6,70 +6,82 @@ from ..utils import setup
class LoadTagTests(SimpleTestCase):
libraries = {
- 'subpackage.echo': 'template_tests.templatetags.subpackage.echo',
- 'testtags': 'template_tests.templatetags.testtags',
+ "subpackage.echo": "template_tests.templatetags.subpackage.echo",
+ "testtags": "template_tests.templatetags.testtags",
}
- @setup({'load01': '{% load testtags subpackage.echo %}{% echo test %} {% echo2 "test" %}'})
+ @setup(
+ {
+ "load01": '{% load testtags subpackage.echo %}{% echo test %} {% echo2 "test" %}'
+ }
+ )
def test_load01(self):
- output = self.engine.render_to_string('load01')
- self.assertEqual(output, 'test test')
+ output = self.engine.render_to_string("load01")
+ self.assertEqual(output, "test test")
- @setup({'load02': '{% load subpackage.echo %}{% echo2 "test" %}'})
+ @setup({"load02": '{% load subpackage.echo %}{% echo2 "test" %}'})
def test_load02(self):
- output = self.engine.render_to_string('load02')
- self.assertEqual(output, 'test')
+ output = self.engine.render_to_string("load02")
+ self.assertEqual(output, "test")
# {% load %} tag, importing individual tags
- @setup({'load03': '{% load echo from testtags %}{% echo this that theother %}'})
+ @setup({"load03": "{% load echo from testtags %}{% echo this that theother %}"})
def test_load03(self):
- output = self.engine.render_to_string('load03')
- self.assertEqual(output, 'this that theother')
+ output = self.engine.render_to_string("load03")
+ self.assertEqual(output, "this that theother")
- @setup({'load04': '{% load echo other_echo from testtags %}'
- '{% echo this that theother %} {% other_echo and another thing %}'})
+ @setup(
+ {
+ "load04": "{% load echo other_echo from testtags %}"
+ "{% echo this that theother %} {% other_echo and another thing %}"
+ }
+ )
def test_load04(self):
- output = self.engine.render_to_string('load04')
- self.assertEqual(output, 'this that theother and another thing')
+ output = self.engine.render_to_string("load04")
+ self.assertEqual(output, "this that theother and another thing")
- @setup({'load05': '{% load echo upper from testtags %}'
- '{% echo this that theother %} {{ statement|upper }}'})
+ @setup(
+ {
+ "load05": "{% load echo upper from testtags %}"
+ "{% echo this that theother %} {{ statement|upper }}"
+ }
+ )
def test_load05(self):
- output = self.engine.render_to_string('load05', {'statement': 'not shouting'})
- self.assertEqual(output, 'this that theother NOT SHOUTING')
+ output = self.engine.render_to_string("load05", {"statement": "not shouting"})
+ self.assertEqual(output, "this that theother NOT SHOUTING")
- @setup({'load06': '{% load echo2 from subpackage.echo %}{% echo2 "test" %}'})
+ @setup({"load06": '{% load echo2 from subpackage.echo %}{% echo2 "test" %}'})
def test_load06(self):
- output = self.engine.render_to_string('load06')
- self.assertEqual(output, 'test')
+ output = self.engine.render_to_string("load06")
+ self.assertEqual(output, "test")
# {% load %} tag errors
- @setup({'load07': '{% load echo other_echo bad_tag from testtags %}'})
+ @setup({"load07": "{% load echo other_echo bad_tag from testtags %}"})
def test_load07(self):
msg = "'bad_tag' is not a valid tag or filter in tag library 'testtags'"
with self.assertRaisesMessage(TemplateSyntaxError, msg):
- self.engine.get_template('load07')
+ self.engine.get_template("load07")
- @setup({'load08': '{% load echo other_echo bad_tag from %}'})
+ @setup({"load08": "{% load echo other_echo bad_tag from %}"})
def test_load08(self):
msg = "'echo' is not a registered tag library. Must be one of:\nsubpackage.echo\ntesttags"
with self.assertRaisesMessage(TemplateSyntaxError, msg):
- self.engine.get_template('load08')
+ self.engine.get_template("load08")
- @setup({'load09': '{% load from testtags %}'})
+ @setup({"load09": "{% load from testtags %}"})
def test_load09(self):
msg = "'from' is not a registered tag library. Must be one of:\nsubpackage.echo\ntesttags"
with self.assertRaisesMessage(TemplateSyntaxError, msg):
- self.engine.get_template('load09')
+ self.engine.get_template("load09")
- @setup({'load10': '{% load echo from bad_library %}'})
+ @setup({"load10": "{% load echo from bad_library %}"})
def test_load10(self):
msg = "'bad_library' is not a registered tag library. Must be one of:\nsubpackage.echo\ntesttags"
with self.assertRaisesMessage(TemplateSyntaxError, msg):
- self.engine.get_template('load10')
+ self.engine.get_template("load10")
- @setup({'load12': '{% load subpackage.missing %}'})
+ @setup({"load12": "{% load subpackage.missing %}"})
def test_load12(self):
msg = "'subpackage.missing' is not a registered tag library. Must be one of:\nsubpackage.echo\ntesttags"
with self.assertRaisesMessage(TemplateSyntaxError, msg):
- self.engine.get_template('load12')
+ self.engine.get_template("load12")