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

Method test_dynamic_inheritance

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

Source from the content-addressed store, hash-verified

146 assert tmpl.render() == "BA"
147
148 def test_dynamic_inheritance(self, env):
149 env = Environment(
150 loader=DictLoader(
151 {
152 "default1": "DEFAULT1{% block x %}{% endblock %}",
153 "default2": "DEFAULT2{% block x %}{% endblock %}",
154 "child": "{% extends default %}{% block x %}CHILD{% endblock %}",
155 }
156 )
157 )
158 tmpl = env.get_template("child")
159 for m in range(1, 3):
160 assert tmpl.render(default=f"default{m}") == f"DEFAULT{m}CHILD"
161
162 def test_multi_inheritance(self, env):
163 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