Coverage for docs_src/dependencies/tutorial001_an_py310.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-05-05 00:03 +0000

1from typing import Annotated 1abcd

2 

3from fastapi import Depends, FastAPI 1abcd

4 

5app = FastAPI() 1abcd

6 

7 

8async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): 1abcd

9 return {"q": q, "skip": skip, "limit": limit} 1efgh

10 

11 

12@app.get("/items/") 1abcd

13async def read_items(commons: Annotated[dict, Depends(common_parameters)]): 1abcd

14 return commons 1efgh

15 

16 

17@app.get("/users/") 1abcd

18async def read_users(commons: Annotated[dict, Depends(common_parameters)]): 1abcd

19 return commons 1efgh