test_features.py
This file
Path
tests/test_features.py
42 lines · 1.2 KiB · Python
Last changed by
Merge pull request #1133 from pallets/revert-renameDavid Lordbefore adoption15337f7
History of this fileTake it
The walk stopped after 200 commits: lines older than 793ddd4 point at it.
Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 1why, one step back1import sysMerge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 2why, one step back2Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 3–4why, one step back3import pytest4Merge pull request #1133 from pallets/revert-renameDavid Lordbefore adoption15337f7
lines 5–8why, one step back5from jinja2 import contextfilter6from jinja2 import Environment7from jinja2 import Template8from jinja2._compat import text_typeMerge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 9–10why, one step back910Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 11why, one step back11@pytest.mark.skipif(sys.version_info < (3, 5), reason="Requires 3.5 or later")Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 12–16why, one step back12def test_generator_stop():13 class X(object):14 def __getattr__(self, name):15 raise StopIteration()16Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 17why, one step back17 t = Template("a{{ bad.bar() }}b")Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 18–21why, one step back18 with pytest.raises(RuntimeError):19 t.render(bad=X())2021Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 22why, one step back22@pytest.mark.skipif(sys.version_info[0] > 2, reason="Feature only supported on 2.x")Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 23–25why, one step back23def test_ascii_str():24 @contextfilter25 def assert_func(context, value):Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 26why, one step back26 assert type(value) is context["expected_type"]Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 27–28why, one step back2728 env = Environment()Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 29why, one step back29 env.filters["assert"] = assert_funcMerge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 30why, one step back30Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 31why, one step back31 env.policies["compiler.ascii_str"] = FalseMerge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 32why, one step back32 t = env.from_string('{{ "foo"|assert }}')Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 33why, one step back33 t.render(expected_type=text_type)Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 34why, one step back34Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 35why, one step back35 env.policies["compiler.ascii_str"] = TrueMerge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
lines 36–39why, one step back36 t = env.from_string('{{ "foo"|assert }}')37 t.render(expected_type=str)3839 for val in True, False:Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 40why, one step back40 env.policies["compiler.ascii_str"] = valMerge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 41why, one step back41 t = env.from_string(u'{{ "\N{SNOWMAN}"|assert }}')Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 42why, one step back42 t.render(expected_type=text_type)