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

Method test_pass_context_callable_class

tests/test_regression.py:301–311  ·  view source on GitHub ↗
(self, env)

Source from the content-addressed store, hash-verified

299 assert e.value.name == "foo/bar.html"
300
301 def test_pass_context_callable_class(self, env):
302 class CallableClass:
303 @pass_context
304 def __call__(self, ctx):
305 return ctx.resolve("hello")
306
307 tpl = Template("""{{ callableclass() }}""")
308 output = tpl.render(callableclass=CallableClass(), hello="TEST")
309 expected = "TEST"
310
311 assert output == expected
312
313 def test_block_set_with_extends(self):
314 env = Environment(

Callers

nothing calls this directly

Calls 3

renderMethod · 0.95
TemplateClass · 0.90
CallableClassClass · 0.85

Tested by

no test coverage detected