MCPcopy Index your code
hub / github.com/fastapi/fastapi / test_nested_router

Function test_nested_router

tests/test_annotated.py:103–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101
102
103def test_nested_router():
104 app = FastAPI()
105
106 router = APIRouter(prefix="/nested")
107
108 @router.get("/test")
109 async def test(var: Annotated[str, Query()] = "bar"):
110 return {"foo": var}
111
112 app.include_router(router)
113
114 client = TestClient(app)
115
116 response = client.get("/nested/test")
117 assert response.status_code == 200
118 assert response.json() == {"foo": "bar"}
119
120
121def test_openapi_schema():

Callers

nothing calls this directly

Calls 4

include_routerMethod · 0.95
FastAPIClass · 0.90
APIRouterClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…