Home / Function/ test_context_binding() — flask Function Reference

test_context_binding() — flask Function Reference

Architecture documentation for the test_context_binding() function in test_reqctx.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  bb4612b4_d149_e80e_a94e_e7837cb7a797["test_context_binding()"]
  aea65cbf_db83_bd4f_d83f_1a35ae104254["test_reqctx.py"]
  bb4612b4_d149_e80e_a94e_e7837cb7a797 -->|defined in| aea65cbf_db83_bd4f_d83f_1a35ae104254
  style bb4612b4_d149_e80e_a94e_e7837cb7a797 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_reqctx.py lines 107–120

def test_context_binding(app):
    @app.route("/")
    def index():
        return f"Hello {flask.request.args['name']}!"

    @app.route("/meh")
    def meh():
        return flask.request.url

    with app.test_request_context("/?name=World"):
        assert index() == "Hello World!"
    with app.test_request_context("/meh"):
        assert meh() == "http://localhost/meh"
    assert not flask.request

Subdomains

Frequently Asked Questions

What does test_context_binding() do?
test_context_binding() is a function in the flask codebase, defined in tests/test_reqctx.py.
Where is test_context_binding() defined?
test_context_binding() is defined in tests/test_reqctx.py at line 107.

Analyze Your Own Codebase

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

Try Supermodel Free