diff options
| author | Tim Graham <timograham@gmail.com> | 2016-04-07 22:04:45 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-04-08 10:12:33 -0400 |
| commit | 92053acbb9160862c3e743a99ed8ccff8d4f8fd6 (patch) | |
| tree | 50e7fd28a650f0e2352cf94f92e5a66d28a81988 /tests/template_tests | |
| parent | df8d8d4292684d6ffa7474f1e201aed486f02b53 (diff) | |
Fixed E128 flake8 warnings in tests/.
Diffstat (limited to 'tests/template_tests')
15 files changed, 48 insertions, 46 deletions
diff --git a/tests/template_tests/filter_tests/test_center.py b/tests/template_tests/filter_tests/test_center.py index 306de33101..c37b7f80c0 100644 --- a/tests/template_tests/filter_tests/test_center.py +++ b/tests/template_tests/filter_tests/test_center.py @@ -7,8 +7,7 @@ from ..utils import setup class CenterTests(SimpleTestCase): - @setup({'center01': - '{% autoescape off %}.{{ a|center:"5" }}. .{{ b|center:"5" }}.{% endautoescape %}'}) + @setup({'center01': '{% autoescape off %}.{{ a|center:"5" }}. .{{ b|center:"5" }}.{% endautoescape %}'}) def test_center01(self): output = self.engine.render_to_string('center01', {"a": "a&b", "b": mark_safe("a&b")}) self.assertEqual(output, ". a&b . . a&b .") diff --git a/tests/template_tests/filter_tests/test_chaining.py b/tests/template_tests/filter_tests/test_chaining.py index 1704715191..9bc3976f37 100644 --- a/tests/template_tests/filter_tests/test_chaining.py +++ b/tests/template_tests/filter_tests/test_chaining.py @@ -14,8 +14,10 @@ class ChainingTests(SimpleTestCase): output = self.engine.render_to_string('chaining01', {'a': 'a < b', 'b': mark_safe('a < b')}) self.assertEqual(output, ' A < b . A < b ') - @setup({'chaining02': - '{% autoescape off %}{{ a|capfirst|center:"7" }}.{{ b|capfirst|center:"7" }}{% endautoescape %}'}) + @setup({ + 'chaining02': + '{% autoescape off %}{{ a|capfirst|center:"7" }}.{{ b|capfirst|center:"7" }}{% endautoescape %}' + }) def test_chaining02(self): output = self.engine.render_to_string('chaining02', {'a': 'a < b', 'b': mark_safe('a < b')}) self.assertEqual(output, ' A < b . A < b ') @@ -26,8 +28,9 @@ class ChainingTests(SimpleTestCase): output = self.engine.render_to_string('chaining03', {'a': 'a < b', 'b': mark_safe('a < b')}) self.assertEqual(output, 'A < .A < ') - @setup({'chaining04': - '{% autoescape off %}{{ a|cut:"b"|capfirst }}.{{ b|cut:"b"|capfirst }}{% endautoescape %}'}) + @setup({ + 'chaining04': '{% autoescape off %}{{ a|cut:"b"|capfirst }}.{{ b|cut:"b"|capfirst }}{% endautoescape %}' + }) def test_chaining04(self): output = self.engine.render_to_string('chaining04', {'a': 'a < b', 'b': mark_safe('a < b')}) self.assertEqual(output, 'A < .A < ') diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py index 5fe35ee378..099ec4d174 100644 --- a/tests/template_tests/filter_tests/test_floatformat.py +++ b/tests/template_tests/filter_tests/test_floatformat.py @@ -14,8 +14,7 @@ from ..utils import setup class FloatformatTests(SimpleTestCase): - @setup({'floatformat01': - '{% autoescape off %}{{ a|floatformat }} {{ b|floatformat }}{% endautoescape %}'}) + @setup({'floatformat01': '{% autoescape off %}{{ a|floatformat }} {{ b|floatformat }}{% endautoescape %}'}) def test_floatformat01(self): output = self.engine.render_to_string('floatformat01', {"a": "1.42", "b": mark_safe("1.42")}) self.assertEqual(output, "1.4 1.4") diff --git a/tests/template_tests/filter_tests/test_linebreaks.py b/tests/template_tests/filter_tests/test_linebreaks.py index 144facf399..50a66f3c47 100644 --- a/tests/template_tests/filter_tests/test_linebreaks.py +++ b/tests/template_tests/filter_tests/test_linebreaks.py @@ -18,8 +18,7 @@ class LinebreaksTests(SimpleTestCase): output = self.engine.render_to_string('linebreaks01', {"a": "x&\ny", "b": mark_safe("x&\ny")}) self.assertEqual(output, "<p>x&<br />y</p> <p>x&<br />y</p>") - @setup({'linebreaks02': - '{% autoescape off %}{{ a|linebreaks }} {{ b|linebreaks }}{% endautoescape %}'}) + @setup({'linebreaks02': '{% autoescape off %}{{ a|linebreaks }} {{ b|linebreaks }}{% endautoescape %}'}) def test_linebreaks02(self): output = self.engine.render_to_string('linebreaks02', {"a": "x&\ny", "b": mark_safe("x&\ny")}) self.assertEqual(output, "<p>x&<br />y</p> <p>x&<br />y</p>") diff --git a/tests/template_tests/filter_tests/test_linebreaksbr.py b/tests/template_tests/filter_tests/test_linebreaksbr.py index c702ba777f..83a15f97db 100644 --- a/tests/template_tests/filter_tests/test_linebreaksbr.py +++ b/tests/template_tests/filter_tests/test_linebreaksbr.py @@ -16,8 +16,7 @@ class LinebreaksbrTests(SimpleTestCase): output = self.engine.render_to_string('linebreaksbr01', {"a": "x&\ny", "b": mark_safe("x&\ny")}) self.assertEqual(output, "x&<br />y x&<br />y") - @setup({'linebreaksbr02': - '{% autoescape off %}{{ a|linebreaksbr }} {{ b|linebreaksbr }}{% endautoescape %}'}) + @setup({'linebreaksbr02': '{% autoescape off %}{{ a|linebreaksbr }} {{ b|linebreaksbr }}{% endautoescape %}'}) def test_linebreaksbr02(self): output = self.engine.render_to_string('linebreaksbr02', {"a": "x&\ny", "b": mark_safe("x&\ny")}) self.assertEqual(output, "x&<br />y x&<br />y") diff --git a/tests/template_tests/filter_tests/test_linenumbers.py b/tests/template_tests/filter_tests/test_linenumbers.py index 36ec8de0d5..2ded01f421 100644 --- a/tests/template_tests/filter_tests/test_linenumbers.py +++ b/tests/template_tests/filter_tests/test_linenumbers.py @@ -17,18 +17,15 @@ class LinenumbersTests(SimpleTestCase): 'linenumbers01', {'a': 'one\n<two>\nthree', 'b': mark_safe('one\n<two>\nthree')}, ) - self.assertEqual(output, '1. one\n2. <two>\n3. three ' - '1. one\n2. <two>\n3. three') + self.assertEqual(output, '1. one\n2. <two>\n3. three 1. one\n2. <two>\n3. three') - @setup({'linenumbers02': - '{% autoescape off %}{{ a|linenumbers }} {{ b|linenumbers }}{% endautoescape %}'}) + @setup({'linenumbers02': '{% autoescape off %}{{ a|linenumbers }} {{ b|linenumbers }}{% endautoescape %}'}) def test_linenumbers02(self): output = self.engine.render_to_string( 'linenumbers02', {'a': 'one\n<two>\nthree', 'b': mark_safe('one\n<two>\nthree')}, ) - self.assertEqual(output, '1. one\n2. <two>\n3. three ' - '1. one\n2. <two>\n3. three') + self.assertEqual(output, '1. one\n2. <two>\n3. three 1. one\n2. <two>\n3. three') class FunctionTests(SimpleTestCase): diff --git a/tests/template_tests/filter_tests/test_make_list.py b/tests/template_tests/filter_tests/test_make_list.py index 16db76057f..454b394d3b 100644 --- a/tests/template_tests/filter_tests/test_make_list.py +++ b/tests/template_tests/filter_tests/test_make_list.py @@ -22,8 +22,7 @@ class MakeListTests(SimpleTestCase): output = self.engine.render_to_string('make_list02', {"a": mark_safe("&")}) self.assertEqual(output, str_prefix("[%(_)s'&']")) - @setup({'make_list03': - '{% autoescape off %}{{ a|make_list|stringformat:"s"|safe }}{% endautoescape %}'}) + @setup({'make_list03': '{% autoescape off %}{{ a|make_list|stringformat:"s"|safe }}{% endautoescape %}'}) def test_make_list03(self): output = self.engine.render_to_string('make_list03', {"a": mark_safe("&")}) self.assertEqual(output, str_prefix("[%(_)s'&']")) diff --git a/tests/template_tests/filter_tests/test_phone2numeric.py b/tests/template_tests/filter_tests/test_phone2numeric.py index 4554d1712f..0c81a904ea 100644 --- a/tests/template_tests/filter_tests/test_phone2numeric.py +++ b/tests/template_tests/filter_tests/test_phone2numeric.py @@ -15,8 +15,7 @@ class Phone2numericTests(SimpleTestCase): ) self.assertEqual(output, '<1-800-2255-63> <1-800-2255-63>') - @setup({'phone2numeric02': - '{% autoescape off %}{{ a|phone2numeric }} {{ b|phone2numeric }}{% endautoescape %}'}) + @setup({'phone2numeric02': '{% autoescape off %}{{ a|phone2numeric }} {{ b|phone2numeric }}{% endautoescape %}'}) def test_phone2numeric02(self): output = self.engine.render_to_string( 'phone2numeric02', diff --git a/tests/template_tests/filter_tests/test_safeseq.py b/tests/template_tests/filter_tests/test_safeseq.py index 9c68d69980..38b1cd6078 100644 --- a/tests/template_tests/filter_tests/test_safeseq.py +++ b/tests/template_tests/filter_tests/test_safeseq.py @@ -10,8 +10,7 @@ class SafeseqTests(SimpleTestCase): output = self.engine.render_to_string('safeseq01', {'a': ['&', '<']}) self.assertEqual(output, '&, < -- &, <') - @setup({'safeseq02': - '{% autoescape off %}{{ a|join:", " }} -- {{ a|safeseq|join:", " }}{% endautoescape %}'}) + @setup({'safeseq02': '{% autoescape off %}{{ a|join:", " }} -- {{ a|safeseq|join:", " }}{% endautoescape %}'}) def test_safeseq02(self): output = self.engine.render_to_string('safeseq02', {'a': ['&', '<']}) self.assertEqual(output, '&, < -- &, <') diff --git a/tests/template_tests/filter_tests/test_stringformat.py b/tests/template_tests/filter_tests/test_stringformat.py index 36939892c5..9501878ebd 100644 --- a/tests/template_tests/filter_tests/test_stringformat.py +++ b/tests/template_tests/filter_tests/test_stringformat.py @@ -11,8 +11,10 @@ class StringformatTests(SimpleTestCase): formatting here only needs to deal with pre-escaped characters. """ - @setup({'stringformat01': - '{% autoescape off %}.{{ a|stringformat:"5s" }}. .{{ b|stringformat:"5s" }}.{% endautoescape %}'}) + @setup({ + 'stringformat01': + '{% autoescape off %}.{{ a|stringformat:"5s" }}. .{{ b|stringformat:"5s" }}.{% endautoescape %}' + }) def test_stringformat01(self): output = self.engine.render_to_string('stringformat01', {'a': 'a<b', 'b': mark_safe('a<b')}) self.assertEqual(output, '. a<b. . a<b.') diff --git a/tests/template_tests/filter_tests/test_urlizetrunc.py b/tests/template_tests/filter_tests/test_urlizetrunc.py index 4badf44029..18a5336c86 100644 --- a/tests/template_tests/filter_tests/test_urlizetrunc.py +++ b/tests/template_tests/filter_tests/test_urlizetrunc.py @@ -7,8 +7,9 @@ from ..utils import setup class UrlizetruncTests(SimpleTestCase): - @setup({'urlizetrunc01': - '{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% endautoescape %}'}) + @setup({ + 'urlizetrunc01': '{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% endautoescape %}' + }) def test_urlizetrunc01(self): output = self.engine.render_to_string( 'urlizetrunc01', diff --git a/tests/template_tests/filter_tests/test_wordwrap.py b/tests/template_tests/filter_tests/test_wordwrap.py index b844ec5108..02f860582b 100644 --- a/tests/template_tests/filter_tests/test_wordwrap.py +++ b/tests/template_tests/filter_tests/test_wordwrap.py @@ -8,8 +8,9 @@ from ..utils import setup class WordwrapTests(SimpleTestCase): - @setup({'wordwrap01': - '{% autoescape off %}{{ a|wordwrap:"3" }} {{ b|wordwrap:"3" }}{% endautoescape %}'}) + @setup({ + 'wordwrap01': '{% autoescape off %}{{ a|wordwrap:"3" }} {{ b|wordwrap:"3" }}{% endautoescape %}' + }) def test_wordwrap01(self): output = self.engine.render_to_string('wordwrap01', {'a': 'a & b', 'b': mark_safe('a & b')}) self.assertEqual(output, 'a &\nb a &\nb') diff --git a/tests/template_tests/syntax_tests/test_autoescape.py b/tests/template_tests/syntax_tests/test_autoescape.py index d58dfc9176..35debd5269 100644 --- a/tests/template_tests/syntax_tests/test_autoescape.py +++ b/tests/template_tests/syntax_tests/test_autoescape.py @@ -23,8 +23,10 @@ class AutoescapeTagTests(SimpleTestCase): self.assertEqual(output, '<b>hello</b>') # Autoescape disabling and enabling nest in a predictable way. - @setup({'autoescape-tag04': '{% autoescape off %}' - '{{ first }} {% autoescape on %}{{ first }}{% endautoescape %}{% endautoescape %}'}) + @setup({ + 'autoescape-tag04': + '{% autoescape off %}{{ first }} {% autoescape on %}{{ first }}{% endautoescape %}{% endautoescape %}' + }) def test_autoescape_tag04(self): output = self.engine.render_to_string('autoescape-tag04', {'first': '<a>'}) self.assertEqual(output, '<a> <a>') @@ -46,8 +48,10 @@ class AutoescapeTagTests(SimpleTestCase): output = self.engine.render_to_string('autoescape-tag07', {'first': mark_safe('<b>Apple</b>')}) self.assertEqual(output, '<b>Apple</b>') - @setup({'autoescape-tag08': r'{% autoescape on %}' - r'{{ var|default_if_none:" endquote\" hah" }}{% endautoescape %}'}) + @setup({ + 'autoescape-tag08': + r'{% autoescape on %}{{ var|default_if_none:" endquote\" hah" }}{% endautoescape %}' + }) def test_autoescape_tag08(self): """ Literal string arguments to filters, if used in the result, are safe. diff --git a/tests/template_tests/syntax_tests/test_cache.py b/tests/template_tests/syntax_tests/test_cache.py index 2039e7808c..7f7a6cd2cb 100644 --- a/tests/template_tests/syntax_tests/test_cache.py +++ b/tests/template_tests/syntax_tests/test_cache.py @@ -100,16 +100,18 @@ class CacheTagTests(SimpleTestCase): """ Regression test for #11270. """ - output = self.engine.render_to_string('cache17', {'poem': 'Oh freddled gruntbuggly/' - 'Thy micturations are to me/' - 'As plurdled gabbleblotchits/' - 'On a lurgid bee/' - 'That mordiously hath bitled out/' - 'Its earted jurtles/' - 'Into a rancid festering/' - 'Or else I shall rend thee in the gobberwarts' - 'with my blurglecruncheon/' - 'See if I dont.'}) + output = self.engine.render_to_string( + 'cache17', + { + 'poem': ( + 'Oh freddled gruntbuggly/Thy micturations are to me/' + 'As plurdled gabbleblotchits/On a lurgid bee/' + 'That mordiously hath bitled out/Its earted jurtles/' + 'Into a rancid festering/Or else I shall rend thee in the gobberwarts' + 'with my blurglecruncheon/See if I dont.' + ), + } + ) self.assertEqual(output, 'Some Content') @setup({'cache18': '{% load cache custom %}{% cache 2|noop:"x y" cache18 %}cache18{% endcache %}'}) diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index ff0b29073f..51dc9f248b 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -44,8 +44,7 @@ class TemplateTests(SimpleTestCase): while tb.tb_next is not None: tb = tb.tb_next depth += 1 - self.assertGreater(depth, 5, - "The traceback context was lost when reraising the traceback. See #19827") + self.assertGreater(depth, 5, "The traceback context was lost when reraising the traceback.") def test_no_wrapped_exception(self): """ |
