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

11 statements  

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

1from typing import Annotated, Union 1abcde

2 

3from fastapi import Depends, FastAPI 1abcde

4 

5app = FastAPI() 1abcde

6 

7 

8async def common_parameters( 1abcde

9 q: Union[str, None] = None, skip: int = 0, limit: int = 100 

10): 

11 return {"q": q, "skip": skip, "limit": limit} 1fghij

12 

13 

14@app.get("/items/") 1abcde

15async def read_items(commons: Annotated[dict, Depends(common_parameters)]): 1abcde

16 return commons 1fghij

17 

18 

19@app.get("/users/") 1abcde

20async def read_users(commons: Annotated[dict, Depends(common_parameters)]): 1abcde

21 return commons 1fghij