summaryrefslogtreecommitdiff
path: root/tests/test_lexnparse.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2017-07-04 09:54:18 -0700
committerDavid Lord <davidism@gmail.com>2017-07-04 10:00:32 -0700
commitfb1e45315ddde51916cba01ed378fb9b8d12323e (patch)
tree4ca9c2a04732fafeb8ebb69104d82338cfc4dd07 /tests/test_lexnparse.py
parent1f1f031c2ec7524fd7fb6b3ba264f045704f432d (diff)
downloadjinja2-feature/kill-stringdefs.tar.gz
go back to generating regex, simplifiedfeature/kill-stringdefs
new version uses ~2KB vs 200KB memory, is ~100x faster to load move script to generate pattern to scripts directory add more tests
Diffstat (limited to 'tests/test_lexnparse.py')
-rw-r--r--tests/test_lexnparse.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test_lexnparse.py b/tests/test_lexnparse.py
index b819627..7da72c0 100644
--- a/tests/test_lexnparse.py
+++ b/tests/test_lexnparse.py
@@ -131,18 +131,24 @@ class TestLexer(object):
(u'fรถรถ', False, True),
(u'ใ', False, True),
(u'_', True, True),
- (u'1a', False, False),
- # special cases in addition to \w
+ (u'1a', False, False), # invalid ascii start
+ (u'a-', False, False), # invalid ascii continue
+ (u'๐Ÿ', False, False), # invalid unicode start
+ (u'a๐Ÿ', False, False), # invalid unicode continue
+ # start characters not matched by \w
(u'\u1885', False, True),
(u'\u1886', False, True),
(u'\u2118', False, True),
(u'\u212e', False, True),
+ # continue character not matched by \w
+ (u'\xb7', False, False),
+ (u'a\xb7', False, True),
))
def test_name(self, env, name, valid2, valid3):
t = u'{{ ' + name + u' }}'
if (valid2 and PY2) or (valid3 and not PY2):
- # shouldn't raise
+ # valid for version being tested, shouldn't raise
env.from_string(t)
else:
pytest.raises(TemplateSyntaxError, env.from_string, t)