From d97ee275ee78ba9c8b40624775c6ee0596a157e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Ram=C3=ADrez?= Date: Wed, 13 May 2015 10:45:58 -0600 Subject: [PATCH] Add new tests for _unescape_entities routine. --- test_secretary.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test_secretary.py b/test_secretary.py index cd15a97..a6cdab9 100644 --- a/test_secretary.py +++ b/test_secretary.py @@ -30,11 +30,24 @@ class RenderTestCase(TestCase): def test__unescape_entities(self): test_samples = { - '{{ "greater_than_1" if 1>0 }}': '{{ "greater_than_1" if 1>0 }}', - '{{ "lower_than_1" if 1<0 }}': '{{ "lower_than_1" if 1<0 }}', - '{{ if multiple_spaces }}': '{{ if multiple_spaces }}', - '{{ if multiple_spaces }}': '{{ if multiple_spaces }}', - '{{ if multiple_spaces }}': '{{ if multiple_spaces }}', + # test scaping of > + '{{ "greater_than_1" if 1>0 }}' : '{{ "greater_than_1" if 1>0 }}', + '{% a > b %}' : '{% a > b %}', + '{{ a > b }}' : '{{ a > b }}', + '{% a|filter > b %}' : '{% a|filter > b %}', + '{% a == b %}{% else if a > b %}': '{% a == b %}{% 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 %}', + '{% a == b %}{% else if a < b %}': '{% a == b %}{% else if a < b %}', + + # test scapig of multiple spaces, even encoded as nodes + '{{ if multiple_spaces }}' : '{{ if multiple_spaces }}', + '{{ if multiple_spaces }}' : '{{ if multiple_spaces }}', + '{{ if multiple_spaces }}' : '{{ if multiple_spaces }}', '{{ if [1,2,3]<2 }}': '{{ if [1,2,3] < 2 }}', }