diff options
author | floatdrop <floatdrop@yandex-team.ru> | 2022-02-10 16:47:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:15 +0300 |
commit | 4267de875ca703ff841f2e025723dadc78f3cc02 (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /contrib/python/Jinja2/py2/tests/test_features.py | |
parent | e63b84f1d39557d9e46ac380b1f388271894293c (diff) | |
download | ydb-4267de875ca703ff841f2e025723dadc78f3cc02.tar.gz |
Restoring authorship annotation for <floatdrop@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Jinja2/py2/tests/test_features.py')
-rw-r--r-- | contrib/python/Jinja2/py2/tests/test_features.py | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/contrib/python/Jinja2/py2/tests/test_features.py b/contrib/python/Jinja2/py2/tests/test_features.py index d65832923e7..34b6f200dea 100644 --- a/contrib/python/Jinja2/py2/tests/test_features.py +++ b/contrib/python/Jinja2/py2/tests/test_features.py @@ -1,42 +1,42 @@ -import sys +import sys + +import pytest -import pytest - from jinja2 import contextfilter from jinja2 import Environment from jinja2 import Template from jinja2._compat import text_type - - + + @pytest.mark.skipif(sys.version_info < (3, 5), reason="Requires 3.5 or later") -def test_generator_stop(): - class X(object): - def __getattr__(self, name): - raise StopIteration() - +def test_generator_stop(): + class X(object): + def __getattr__(self, name): + raise StopIteration() + t = Template("a{{ bad.bar() }}b") - with pytest.raises(RuntimeError): - t.render(bad=X()) - - + with pytest.raises(RuntimeError): + t.render(bad=X()) + + @pytest.mark.skipif(sys.version_info[0] > 2, reason="Feature only supported on 2.x") -def test_ascii_str(): - @contextfilter - def assert_func(context, value): +def test_ascii_str(): + @contextfilter + def assert_func(context, value): assert type(value) is context["expected_type"] - - env = Environment() + + env = Environment() env.filters["assert"] = assert_func - + env.policies["compiler.ascii_str"] = False - t = env.from_string('{{ "foo"|assert }}') + t = env.from_string('{{ "foo"|assert }}') t.render(expected_type=text_type) - + env.policies["compiler.ascii_str"] = True - t = env.from_string('{{ "foo"|assert }}') - t.render(expected_type=str) - - for val in True, False: + t = env.from_string('{{ "foo"|assert }}') + t.render(expected_type=str) + + for val in True, False: env.policies["compiler.ascii_str"] = val - t = env.from_string(u'{{ "\N{SNOWMAN}"|assert }}') + t = env.from_string(u'{{ "\N{SNOWMAN}"|assert }}') t.render(expected_type=text_type) |