Code

Ticket #5971: tests_for_5971.diff

File tests_for_5971.diff, 1.1 KB (added by adamv, 6 years ago)
Line 
1Index: tests/regressiontests/tokenparser/__init__.py
2===================================================================
3Index: tests/regressiontests/tokenparser/tests.py
4===================================================================
5--- tests/regressiontests/tokenparser/tests.py  (revision 0)
6+++ tests/regressiontests/tokenparser/tests.py  (revision 0)
7@@ -0,0 +1,44 @@
8+"""
9+Tests for TokenParser behavior in the face of quoted strings with spaces.
10+
11+>>> from django.template import TokenParser
12+
13+
14+Test case 1: {% tag thevar|filter sometag %}
15+
16+>>> p = TokenParser("tag thevar|filter sometag")
17+>>> p.tagname
18+'tag'
19+
20+>>> p.value()
21+'thevar|filter'
22+
23+>>> p.more()
24+True
25+
26+>>> p.tag()
27+'sometag'
28+
29+>>> p.more()
30+False
31+
32+
33+Test case 2: {% tag "a value"|filter sometag %}
34+
35+>>> p = TokenParser('tag "a value"|filter sometag')
36+>>> p.tagname
37+'tag'
38+
39+>>> p.value()
40+'"a value"|filter'
41+
42+>>> p.more()
43+True
44+
45+>>> p.tag()
46+'sometag'
47+
48+
49+>>> p.more()
50+False
51+"""
52Index: tests/regressiontests/tokenparser/models.py
53===================================================================