Home / Function/ test_blueprint_url_processors() — flask Function Reference

test_blueprint_url_processors() — flask Function Reference

Architecture documentation for the test_blueprint_url_processors() function in test_blueprints.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  5afc0b6e_5eeb_36d4_5bd7_9ff759f72d79["test_blueprint_url_processors()"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8["test_blueprints.py"]
  5afc0b6e_5eeb_36d4_5bd7_9ff759f72d79 -->|defined in| 4366a441_d387_52f9_ec8d_1c41c71c00a8
  style 5afc0b6e_5eeb_36d4_5bd7_9ff759f72d79 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_blueprints.py lines 151–173

def test_blueprint_url_processors(app, client):
    bp = flask.Blueprint("frontend", __name__, url_prefix="/<lang_code>")

    @bp.url_defaults
    def add_language_code(endpoint, values):
        values.setdefault("lang_code", flask.g.lang_code)

    @bp.url_value_preprocessor
    def pull_lang_code(endpoint, values):
        flask.g.lang_code = values.pop("lang_code")

    @bp.route("/")
    def index():
        return flask.url_for(".about")

    @bp.route("/about")
    def about():
        return flask.url_for(".index")

    app.register_blueprint(bp)

    assert client.get("/de/").data == b"/de/about"
    assert client.get("/de/about").data == b"/de/"

Subdomains

Frequently Asked Questions

What does test_blueprint_url_processors() do?
test_blueprint_url_processors() is a function in the flask codebase, defined in tests/test_blueprints.py.
Where is test_blueprint_url_processors() defined?
test_blueprint_url_processors() is defined in tests/test_blueprints.py at line 151.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free