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

Method test_preserve_blocks

tests/test_inheritance.py:135–146  ·  tests/test_inheritance.py::TestInheritance.test_preserve_blocks
(self, env)

Source from the content-addressed store, hash-verified

133 assert tmpl.render() == class="st">"42|42|42"
134
135 def test_preserve_blocks(self, env):
136 env = Environment(
137 loader=DictLoader(
138 {
139 class="st">"a": class="st">"{% if false %}{% block x %}A{% endblock %}"
140 class="st">"{% endif %}{{ self.x() }}",
141 class="st">"b": &class="cm">#x27;{% extends class="st">"a" %}{% block x %}B{{ super() }}{% endblock %}',
142 }
143 )
144 )
145 tmpl = env.get_template(class="st">"b")
146 assert tmpl.render() == class="st">"BA"
147
148 def test_dynamic_inheritance(self, env):
149 env = Environment(

Callers

nothing calls this directly

Calls 4

get_templateMethod · 0.95
EnvironmentClass · 0.90
DictLoaderClass · 0.90
renderMethod · 0.45

Tested by

no test coverage detected