Skip to content

Commit c9fa6f4

Browse files
committed
Test {% verbatim %} with bulky non-ascii
1 parent 147fdc5 commit c9fa6f4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/test_simple.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
# TODO: test what happens if TEMPLATE_DEBUG is not set.
77

88

9+
# 200 Unicode chars: snowman + poo.
10+
UNIUNI = u"\u26C4\U0001F4A9"*100
11+
if isinstance(UNIUNI, type("")):
12+
UNISTR = UNIUNI
13+
else:
14+
UNISTR = UNIUNI.encode("utf8")
15+
16+
917
class SimpleTemplateTest(DjangoPluginTestCase):
1018

1119
def test_one_line(self):
@@ -203,14 +211,15 @@ def test_verbatim(self):
203211
{% verbatim %}
204212
{{if dying}}Alive.{{/if}}
205213
second.
206-
{%third%}.
214+
{%third%}.UNISTR
207215
{% endverbatim %}
208216
7
209-
""")
217+
""".replace("UNISTR", UNISTR))
210218
text = self.run_django_coverage()
211219
self.assertEqual(
212220
text,
213-
"1\n\n{{if dying}}Alive.{{/if}}\nsecond.\n{%third%}.\n\n7\n"
221+
u"1\n\n{{if dying}}Alive.{{/if}}\nsecond.\n"
222+
u"{%third%}.UNIUNI\n\n7\n".replace(u"UNIUNI", UNIUNI)
214223
)
215224
self.assert_analysis([1, 2, 3, 4, 5, 7])
216225

0 commit comments

Comments
 (0)