Home / Function/ get_client() — fastapi Function Reference

get_client() — fastapi Function Reference

Architecture documentation for the get_client() function in test_arbitrary_types.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  4cc3e957_50b2_6cc9_ed1f_964715785470["get_client()"]
  0a65a3af_f6dc_1275_2ed7_2fa9f4e69088["test_arbitrary_types.py"]
  4cc3e957_50b2_6cc9_ed1f_964715785470 -->|defined in| 0a65a3af_f6dc_1275_2ed7_2fa9f4e69088
  style 4cc3e957_50b2_6cc9_ed1f_964715785470 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_arbitrary_types.py lines 10–40

def get_client():
    from pydantic import (
        BaseModel,
        ConfigDict,
        PlainSerializer,
        TypeAdapter,
        WithJsonSchema,
    )

    class FakeNumpyArray:
        def __init__(self):
            self.data = [1.0, 2.0, 3.0]

    FakeNumpyArrayPydantic = Annotated[
        FakeNumpyArray,
        WithJsonSchema(TypeAdapter(list[float]).json_schema()),
        PlainSerializer(lambda v: v.data),
    ]

    class MyModel(BaseModel):
        model_config = ConfigDict(arbitrary_types_allowed=True)
        custom_field: FakeNumpyArrayPydantic

    app = FastAPI()

    @app.get("/")
    def test() -> MyModel:
        return MyModel(custom_field=FakeNumpyArray())

    client = TestClient(app)
    return client

Domain

Subdomains

Frequently Asked Questions

What does get_client() do?
get_client() is a function in the fastapi codebase, defined in tests/test_arbitrary_types.py.
Where is get_client() defined?
get_client() is defined in tests/test_arbitrary_types.py at line 10.

Analyze Your Own Codebase

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

Try Supermodel Free