Home / Function/ test_response_type_errors() — flask Function Reference

test_response_type_errors() — flask Function Reference

Architecture documentation for the test_response_type_errors() function in test_basic.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  2e4497d1_3d35_44a8_b698_539453681102["test_response_type_errors()"]
  85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"]
  2e4497d1_3d35_44a8_b698_539453681102 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f
  style 2e4497d1_3d35_44a8_b698_539453681102 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_basic.py lines 1216–1262

def test_response_type_errors():
    app = flask.Flask(__name__)
    app.testing = True

    @app.route("/none")
    def from_none():
        pass

    @app.route("/small_tuple")
    def from_small_tuple():
        return ("Hello",)

    @app.route("/large_tuple")
    def from_large_tuple():
        return "Hello", 234, {"X-Foo": "Bar"}, "???"

    @app.route("/bad_type")
    def from_bad_type():
        return True

    @app.route("/bad_wsgi")
    def from_bad_wsgi():
        return lambda: None

    c = app.test_client()

    with pytest.raises(TypeError) as e:
        c.get("/none")

    assert "returned None" in str(e.value)
    assert "from_none" in str(e.value)

    with pytest.raises(TypeError) as e:
        c.get("/small_tuple")

    assert "tuple must have the form" in str(e.value)

    with pytest.raises(TypeError):
        c.get("/large_tuple")

    with pytest.raises(TypeError) as e:
        c.get("/bad_type")

    assert "it was a bool" in str(e.value)

    with pytest.raises(TypeError):
        c.get("/bad_wsgi")

Subdomains

Defined In

Frequently Asked Questions

What does test_response_type_errors() do?
test_response_type_errors() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_response_type_errors() defined?
test_response_type_errors() is defined in tests/test_basic.py at line 1216.

Analyze Your Own Codebase

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

Try Supermodel Free