Skip to content
Myr

fix unicode for py2

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 5de1f1b · Browse files · 1 file+13 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−13 removed

  • tests:+13 added−13 removed

1 file+13 added−13 removed

modified:tests/test_lexnparse.py+13 added-13 removed
124 unmodified lines
125 expect = expected.get(keep, template)126 result = tmpl.render()127 assert result == expect, (keep, template, result, expect)128129 @pytest.mark.parametrize('name,valid', (130 ('foo', True),131 ('föö', True),132 ('き', True),133 ('_', True),134 ('1a', False),129 @pytest.mark.parametrize('name,valid2,valid3', (130 (u'foo', True, True),131 (u'föö', False, True),132 (u'き', False, True),133 (u'_', True, True),134 (u'1a', False, False),135 # special cases in addition to \w136 ('\u1885', True),137 ('\u1886', True),138 ('\u2118', True),139 ('\u212e', True),136 (u'ᢅ', False, True), # 1885137 (u'ᢆ', False, True), # 1886138 (u'℘', False, True), # 2118139 (u'℮', False, True), # 212e140 ))141 def test_name(self, env, name, valid):142 t = '{{ ' + name + ' }}'141 def test_name(self, env, name, valid2, valid3):142 t = u'{{ ' + name + u' }}'143144 if valid:144 if (valid2 and PY2) or (valid3 and not PY2):145 # shouldn't raise146 env.from_string(t)147 else:148 pytest.raises(TemplateSyntaxError, env.from_string, t)
486 unmodified lines