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

Method test_scoped_block

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

Source from the content-addressed store, hash-verified

179 assert tmpl.render() == "DEFAULT1CHILD"
180
181 def test_scoped_block(self, env):
182 env = Environment(
183 loader=DictLoader(
184 {
185 "default.html": "{% for item in seq %}[{% block item scoped %}"
186 "{% endblock %}]{% endfor %}"
187 }
188 )
189 )
190 t = env.from_string(
191 "{% extends 'default.html' %}{% block item %}{{ item }}{% endblock %}"
192 )
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(

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