Skip to content
Myr

Added testcase for a 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 d416a97 · Browse files · 2 files+23 added−1 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+23 added−1 removed

  • tests:+20 added−0 removed
  • other:+3 added−1 removed

2 files+23 added−1 removed

modified:jinja2/compiler.py+3 added-1 removed
593 unmodified lines
594595 # variables that are undeclared (accessed before declaration) and596 # declared locally *and* part of an outside scope raise a template597 # assertion error. Reason: we can't generate reasonable code from598 # it without aliasing all the variables. XXX: alias them ^^598 # it without aliasing all the variables.599 # this could be fixed in Python 3 where we have the nonlocal600 # keyword or if we switch to bytecode generation601 overriden_closure_vars = (602 func_frame.identifiers.undeclared &603 func_frame.identifiers.declared &604 (func_frame.identifiers.declared_locally |
894 unmodified lines
modified:tests/test_old_bugs.py+20 added
31 unmodified lines
3233def test_urlize_filter_escaping(env):34 tmpl = env.from_string('{{ "http://www.example.org/<foo"|urlize }}')35 assert tmpl.render() == '<a href="http://www.example.org/&lt;foo">http://www.example.org/&lt;foo</a>'363738def test_loop_call_loop(env):39 tmpl = env.from_string('''4041 {% macro test() %}42 {{ caller() }}43 {% endmacro %}4445 {% for num1 in range(5) %}46 {% call test() %}47 {% for num2 in range(10) %}48 {{ loop.index }}49 {% endfor %}50 {% endcall %}51 {% endfor %}5253 ''')5455 assert tmpl.render() == ''