Skip to content

Commit

Permalink
Ensure set vars work fine with set|filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Jan 7, 2017
1 parent 7d1b378 commit 1a72eac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_core_tags.py
Expand Up @@ -367,3 +367,17 @@ def test_block_filtered(self, env_trim):
'{{ foo }}')
assert tmpl.render() == '2'
assert tmpl.module.foo == u'2'

def test_block_filtered_set(self, env_trim):
def _myfilter(val, arg):
assert arg == ' xxx '
return val
env_trim.filters['myfilter'] = _myfilter
tmpl = env_trim.from_string(
'{% set a = " xxx " %}'
'{% set foo | myfilter(a) | trim | length | string %}'
' {% set b = " yy " %} 42 {{ a }}{{ b }} '
'{% endset %}'
'{{ foo }}')
assert tmpl.render() == '11'
assert tmpl.module.foo == u'11'

0 comments on commit 1a72eac

Please sign in to comment.