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

11 statements  

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

1from typing import Union 1abcdef

2 

3from fastapi import Depends, FastAPI 1abcdef

4 

5app = FastAPI() 1abcdef

6 

7 

8async def common_parameters( 1abcdef

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

10): 

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

12 

13 

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

15async def read_items(commons: dict = Depends(common_parameters)): 1abcdef

16 return commons 1ghijkl

17 

18 

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

20async def read_users(commons: dict = Depends(common_parameters)): 1abcdef

21 return commons 1ghijkl