Skip to content
Myr

added unittest for the latest fixed bug

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

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent e224488 · Browse files · 1 file+11 added−0 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+11 added−0 removed

  • tests:+11 added−0 removed

1 file+11 added−0 removed

modified:tests/test_forloop.py+11 added
22 unmodified lines
23NONITER = '''{% for item in none %}...{% endfor %}'''24RECURSIVE = '''{% for item in seq recursive -%}25 [{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]26{%- endfor %}'''27LOOPLOOP = '''{% for row in table %}28 {%- set rowloop = loop -%}29 {% for cell in row -%}30 [{{ rowloop.index }}|{{ loop.index }}]31 {%- endfor %}32{%- endfor %}'''333435def test_simple(env):36 tmpl = env.from_string(SIMPLE)
59 unmodified lines
96 dict(a=1, b=[dict(a=1), dict(a=2)]),97 dict(a=2, b=[dict(a=1), dict(a=2)]),98 dict(a=3, b=[dict(a='a')])99 ]) == '[1<[1][2]>][2<[1][2]>][3<[a]>]'100101102def test_looploop(env):103 tmpl = env.from_string(LOOPLOOP)104 assert tmpl.render(table=['ab', 'cd']) == '[1|1][1|2][2|1][2|2]'