Home / Function/ test_test_client_context_binding() — flask Function Reference

test_test_client_context_binding() — flask Function Reference

Architecture documentation for the test_test_client_context_binding() function in test_testing.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  672dacad_8a8f_0bcc_5410_5b39d0738734["test_test_client_context_binding()"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0["test_testing.py"]
  672dacad_8a8f_0bcc_5410_5b39d0738734 -->|defined in| 8c162ff0_0a8a_d943_77b6_c07b38d297a0
  style 672dacad_8a8f_0bcc_5410_5b39d0738734 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_testing.py lines 201–227

def test_test_client_context_binding(app, client):
    app.testing = False

    @app.route("/")
    def index():
        flask.g.value = 42
        return "Hello World!"

    @app.route("/other")
    def other():
        raise ZeroDivisionError

    with client:
        resp = client.get("/")
        assert flask.g.value == 42
        assert resp.data == b"Hello World!"
        assert resp.status_code == 200

    with client:
        resp = client.get("/other")
        assert not hasattr(flask.g, "value")
        assert b"Internal Server Error" in resp.data
        assert resp.status_code == 500
        flask.g.value = 23

    with pytest.raises(RuntimeError):
        flask.g.value  # noqa: B018

Subdomains

Frequently Asked Questions

What does test_test_client_context_binding() do?
test_test_client_context_binding() is a function in the flask codebase, defined in tests/test_testing.py.
Where is test_test_client_context_binding() defined?
test_test_client_context_binding() is defined in tests/test_testing.py at line 201.

Analyze Your Own Codebase

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

Try Supermodel Free