MCPcopy
hub / github.com/pallets/jinja / test_super_in_scoped_block

Method test_super_in_scoped_block

tests/test_inheritance.py:195–208  ·  view source on GitHub ↗
(self, env)

Source from the content-addressed store, hash-verified

193 assert t.render(seq=list(range(5))) == "[0][1][2][3][4]"
194
195 def test_super_in_scoped_block(self, env):
196 env = Environment(
197 loader=DictLoader(
198 {
199 "default.html": "{% for item in seq %}[{% block item scoped %}"
200 "{{ item }}{% endblock %}]{% endfor %}"
201 }
202 )
203 )
204 t = env.from_string(
205 '{% extends "default.html" %}{% block item %}'
206 "{{ super() }}|{{ item * 2 }}{% endblock %}"
207 )
208 assert t.render(seq=list(range(5))) == "[0|0][1|2][2|4][3|6][4|8]"
209
210 def test_scoped_block_after_inheritance(self, env):
211 env = Environment(

Callers

nothing calls this directly

Calls 4

from_stringMethod · 0.95
EnvironmentClass · 0.90
DictLoaderClass · 0.90
renderMethod · 0.45

Tested by

no test coverage detected