Add new tests for _unescape_entities routine.
This commit is contained in:
parent
8031bc3876
commit
d97ee275ee
1 changed files with 18 additions and 5 deletions
|
|
@ -30,11 +30,24 @@ class RenderTestCase(TestCase):
|
||||||
|
|
||||||
def test__unescape_entities(self):
|
def test__unescape_entities(self):
|
||||||
test_samples = {
|
test_samples = {
|
||||||
'{{ "greater_than_1" if 1>0 }}': '{{ "greater_than_1" if 1>0 }}',
|
# test scaping of >
|
||||||
'{{ "lower_than_1" if 1<0 }}': '{{ "lower_than_1" if 1<0 }}',
|
'{{ "greater_than_1" if 1>0 }}' : '{{ "greater_than_1" if 1>0 }}',
|
||||||
'{{ if <text:s> multiple_spaces }}': '{{ if multiple_spaces }}',
|
'{% a > b %}' : '{% a > b %}',
|
||||||
'{{ if </text:s> multiple_spaces }}': '{{ if multiple_spaces }}',
|
'{{ a > b }}' : '{{ a > b }}',
|
||||||
'{{ if <text:s/> multiple_spaces }}': '{{ if multiple_spaces }}',
|
'{% a|filter > b %}' : '{% a|filter > b %}',
|
||||||
|
'<node>{% a == b %}</node>{% else if a > b %}': '<node>{% a == b %}</node>{% else if a > b %}',
|
||||||
|
|
||||||
|
# test scaping of < and "
|
||||||
|
'{{ "lower_than_1" if 1<0 }}' : '{{ "lower_than_1" if 1<0 }}',
|
||||||
|
'{% a < b %}' : '{% a < b %}',
|
||||||
|
'{{ a < b }}' : '{{ a < b }}',
|
||||||
|
'{% a|filter < b %}' : '{% a|filter < b %}',
|
||||||
|
'<node>{% a == b %}</node>{% else if a < b %}': '<node>{% a == b %}</node>{% else if a < b %}',
|
||||||
|
|
||||||
|
# test scapig of multiple spaces, even encoded as <text:space> nodes
|
||||||
|
'{{ if <text:s> multiple_spaces }}' : '{{ if multiple_spaces }}',
|
||||||
|
'{{ if </text:s> multiple_spaces }}' : '{{ if multiple_spaces }}',
|
||||||
|
'{{ if <text:s/> multiple_spaces }}' : '{{ if multiple_spaces }}',
|
||||||
'{{ if <text:span/>[1,2,3]<text:span><</text:span>2 }}': '{{ if [1,2,3] < 2 }}',
|
'{{ if <text:span/>[1,2,3]<text:span><</text:span>2 }}': '{{ if [1,2,3] < 2 }}',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue