Skip to content

Commit c292e5f

Browse files
committed
Ensure set vars work fine with set|filter
1 parent 22c3038 commit c292e5f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_core_tags.py

+14
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,20 @@ def test_block_filtered(self, env_trim):
466466
assert tmpl.render() == '2'
467467
assert tmpl.module.foo == u'2'
468468

469+
def test_block_filtered_set(self, env_trim):
470+
def _myfilter(val, arg):
471+
assert arg == ' xxx '
472+
return val
473+
env_trim.filters['myfilter'] = _myfilter
474+
tmpl = env_trim.from_string(
475+
'{% set a = " xxx " %}'
476+
'{% set foo | myfilter(a) | trim | length | string %}'
477+
' {% set b = " yy " %} 42 {{ a }}{{ b }} '
478+
'{% endset %}'
479+
'{{ foo }}')
480+
assert tmpl.render() == '11'
481+
assert tmpl.module.foo == u'11'
482+
469483

470484
@pytest.mark.core_tags
471485
@pytest.mark.with_

0 commit comments

Comments
 (0)