Home / Function/ test_complex() — fastapi Function Reference

test_complex() — fastapi Function Reference

Architecture documentation for the test_complex() function in test_compat.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  837ddd42_8756_dfaa_fe5f_3dba8224d42a["test_complex()"]
  d8f09690_317a_a71d_db2f_7a9171e4e6fd["test_compat.py"]
  837ddd42_8756_dfaa_fe5f_3dba8224d42a -->|defined in| d8f09690_317a_a71d_db2f_7a9171e4e6fd
  style 837ddd42_8756_dfaa_fe5f_3dba8224d42a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_compat.py lines 25–40

def test_complex():
    app = FastAPI()

    @app.post("/")
    def foo(foo: Union[str, list[int]]):
        return foo

    client = TestClient(app)

    response = client.post("/", json="bar")
    assert response.status_code == 200, response.text
    assert response.json() == "bar"

    response2 = client.post("/", json=[1, 2])
    assert response2.status_code == 200, response2.text
    assert response2.json() == [1, 2]

Domain

Subdomains

Frequently Asked Questions

What does test_complex() do?
test_complex() is a function in the fastapi codebase, defined in tests/test_compat.py.
Where is test_complex() defined?
test_complex() is defined in tests/test_compat.py at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free