MCPcopy
hub / github.com/fastapi/fastapi / get_client

Function get_client

tests/test_schema_compat_pydantic_v2.py:12–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11@pytest.fixture(name="client")
12def get_client():
13 from enum import Enum
14
15 app = FastAPI()
16
17 class PlatformRole(str, Enum):
18 admin = "admin"
19 user = "user"
20
21 class OtherRole(str, Enum): ...
22
23 class User(BaseModel):
24 username: str
25 role: PlatformRole | OtherRole
26
27 @app.get("/users")
28 async def get_user() -> User:
29 return {"username": "alice", "role": "admin"} # ty: ignore[invalid-return-type]
30
31 client = TestClient(app)
32 return client
33
34
35@needs_py310

Callers

nothing calls this directly

Calls 1

FastAPIClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…