Home / Function/ test_invalid_response_model_field() — fastapi Function Reference

test_invalid_response_model_field() — fastapi Function Reference

Architecture documentation for the test_invalid_response_model_field() function in test_response_model_as_return_annotation.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  5913fa57_40c4_7b18_4fa6_77135073106b["test_invalid_response_model_field()"]
  cda67a9f_f26d_7734_ec51_1b0ee38954cf["test_response_model_as_return_annotation.py"]
  5913fa57_40c4_7b18_4fa6_77135073106b -->|defined in| cda67a9f_f26d_7734_ec51_1b0ee38954cf
  style 5913fa57_40c4_7b18_4fa6_77135073106b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_response_model_as_return_annotation.py lines 501–510

def test_invalid_response_model_field():
    app = FastAPI()
    with pytest.raises(FastAPIError) as e:

        @app.get("/")
        def read_root() -> Union[Response, None]:
            return Response(content="Foo")  # pragma: no cover

    assert "valid Pydantic field type" in e.value.args[0]
    assert "parameter response_model=None" in e.value.args[0]

Domain

Subdomains

Frequently Asked Questions

What does test_invalid_response_model_field() do?
test_invalid_response_model_field() is a function in the fastapi codebase, defined in tests/test_response_model_as_return_annotation.py.
Where is test_invalid_response_model_field() defined?
test_invalid_response_model_field() is defined in tests/test_response_model_as_return_annotation.py at line 501.

Analyze Your Own Codebase

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

Try Supermodel Free