Ticket #5971: tests_for_5971.diff

File tests_for_5971.diff, 1.1 KB (added by Adam Vandenberg, 16 years ago)
  • tests/regressiontests/tokenparser/tests.py

     
     1"""
     2Tests for TokenParser behavior in the face of quoted strings with spaces.
     3
     4>>> from django.template import TokenParser
     5
     6
     7Test case 1: {% tag thevar|filter sometag %}
     8
     9>>> p = TokenParser("tag thevar|filter sometag")
     10>>> p.tagname
     11'tag'
     12
     13>>> p.value()
     14'thevar|filter'
     15
     16>>> p.more()
     17True
     18
     19>>> p.tag()
     20'sometag'
     21
     22>>> p.more()
     23False
     24
     25
     26Test case 2: {% tag "a value"|filter sometag %}
     27
     28>>> p = TokenParser('tag "a value"|filter sometag')
     29>>> p.tagname
     30'tag'
     31
     32>>> p.value()
     33'"a value"|filter'
     34
     35>>> p.more()
     36True
     37
     38>>> p.tag()
     39'sometag'
     40
     41
     42>>> p.more()
     43False
     44"""
Back to Top