MCPcopy Create free account
hub / github.com/pallets/quart / test_template_tests

Function test_template_tests

tests/test_templating.py:122–141  ·  view source on GitHub ↗
(app: Quart, blueprint: Blueprint)

Source from the content-addressed store, hash-verified

120
121
122async def test_template_tests(app: Quart, blueprint: Blueprint) -> None:
123 @blueprint.app_template_test()
124 def blueprint_test(value: int) -> bool:
125 return value == 5
126
127 @app.template_test()
128 def app_test(value: int) -> bool:
129 return value == 3
130
131 app.register_blueprint(blueprint)
132
133 async with app.app_context():
134 rendered = await render_template_string("{% if 3 is app_test %}foo{% endif %}")
135 assert rendered == "foo"
136
137 async with app.test_request_context("/"):
138 rendered = await render_template_string(
139 "{% if 5 is blueprint_test %}bar{% endif %}"
140 )
141 assert rendered == "bar"
142
143
144async def test_simple_stream(app: Quart) -> None:

Callers

nothing calls this directly

Calls 3

render_template_stringFunction · 0.90
app_contextMethod · 0.80
test_request_contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…