Add new tests for _unescape_entities routine.

This commit is contained in:
Christopher Ramírez 2015-05-13 10:45:58 -06:00
parent 8031bc3876
commit d97ee275ee

View file

@ -30,8 +30,21 @@ class RenderTestCase(TestCase):
def test__unescape_entities(self):
test_samples = {
# test scaping of >
'{{ "greater_than_1" if 1>0 }}' : '{{ "greater_than_1" if 1>0 }}',
'{{ "lower_than_1" if 1&lt;0 }}': '{{ "lower_than_1" if 1<0 }}',
'{% a &gt; b %}' : '{% a > b %}',
'{{ a &gt; b }}' : '{{ a > b }}',
'{% a|filter &gt; b %}' : '{% a|filter > b %}',
'<node>{% a == b %}</node>{% else if a &gt; b %}': '<node>{% a == b %}</node>{% else if a > b %}',
# test scaping of &lt; and &quot;
'{{ &quot;lower_than_1&quot; if 1&lt;0 }}' : '{{ "lower_than_1" if 1<0 }}',
'{% a &lt; b %}' : '{% a < b %}',
'{{ a &lt; b }}' : '{{ a < b }}',
'{% a|filter &lt; b %}' : '{% a|filter < b %}',
'<node>{% a == b %}</node>{% else if a &lt; 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 }}',