MCPcopy
hub / github.com/pallets/flask / test_add_template_test_with_name

Function test_add_template_test_with_name

tests/test_blueprints.py:537–547  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

535
536
537def test_add_template_test_with_name(app):
538 bp = flask.Blueprint("bp", __name__)
539
540 def is_boolean(value):
541 return isinstance(value, bool)
542
543 bp.add_app_template_test(is_boolean, "boolean")
544 app.register_blueprint(bp, url_prefix="/py")
545 assert "boolean" in app.jinja_env.tests.keys()
546 assert app.jinja_env.tests["boolean"] == is_boolean
547 assert app.jinja_env.tests["boolean"](False)
548
549
550def test_template_test_with_template(app, client):

Callers

nothing calls this directly

Calls 2

add_app_template_testMethod · 0.95
register_blueprintMethod · 0.45

Tested by

no test coverage detected