Skip to content
Myr

Moved with test to coretags

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

authored by Armin Ronacher · committed by Armin Ronacher · parent b1a56de · Browse files · 2 files+16 added−11 removed
This commit

State

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

Diff stats

2 files+16 added−11 removed

  • tests:+16 added−11 removed

2 files+16 added−11 removed

modified:tests/test_core_tags.py+16 added
361 unmodified lines
362 env = Environment(autoescape=True)363 tmpl = env.from_string('{% set foo %}<em>{{ test }}</em>'364 '{% endset %}foo: {{ foo }}')365 assert tmpl.render(test='<unsafe>') == 'foo: <em>&lt;unsafe&gt;</em>'366367368@pytest.mark.core_tags369@pytest.mark.with_370class TestWith(object):371372 def test_with(self):373 env = Environment(extensions=['jinja2.ext.with_'])374 tmpl = env.from_string('''\375 {% with a=42, b=23 -%}376 {{ a }} = {{ b }}377 {% endwith -%}378 {{ a }} = {{ b }}\379 ''')380 assert [x.strip() for x in tmpl.render(a=1, b=2).splitlines()] \381 == ['42 = 23', '1 = 2']
modified:tests/test_ext.py-11 removed
193 unmodified lines
194 {%- do items.append(loop.index0 ~ char) %}195 {%- endfor %}{{ items|join(', ') }}''')196 assert tmpl.render() == '0f, 1o, 2o'197198 def test_with(self):199 env = Environment(extensions=['jinja2.ext.with_'])200 tmpl = env.from_string('''\201 {% with a=42, b=23 -%}202 {{ a }} = {{ b }}203 {% endwith -%}204 {{ a }} = {{ b }}\205 ''')206 assert [x.strip() for x in tmpl.render(a=1, b=2).splitlines()] \207 == ['42 = 23', '1 = 2']208198 def test_extension_nodes(self):199 env = Environment(extensions=[ExampleExtension])200 tmpl = env.from_string('{% test %}')201 assert tmpl.render() == 'False|42|23|{}'
263 unmodified lines