MCPcopy Create free account
hub / github.com/pallets/flask / test_custom_template_loader

Function test_custom_template_loader

tests/test_templating.py:324–339  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

322
323
324def test_custom_template_loader(client):
325 class MyFlask(flask.Flask):
326 def create_global_jinja_loader(self):
327 from jinja2 import DictLoader
328
329 return DictLoader({"index.html": "Hello Custom World!"})
330
331 app = MyFlask(__name__)
332
333 @app.route("/")
334 def index():
335 return flask.render_template("index.html")
336
337 c = app.test_client()
338 rv = c.get("/")
339 assert rv.data == b"Hello Custom World!"
340
341
342def test_iterable_loader(app, client):

Callers

nothing calls this directly

Calls 3

test_clientMethod · 0.80
MyFlaskClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected