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 Jun 24, 2017
1 parent e623b58 commit 0849f32
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_core_tags.py
Expand Up @@ -457,6 +457,20 @@ def test_block_filtered(self, env_trim):
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'


@pytest.mark.core_tags
@pytest.mark.with_
Expand Down

0 comments on commit 0849f32

Please sign in to comment.