Coverage for docs_src / path_params_numeric_validations / tutorial002_py310.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1from fastapi import FastAPI, Path 1abc

2 

3app = FastAPI() 1abc

4 

5 

6@app.get("/items/{item_id}") 1abc

7async def read_items(q: str, item_id: int = Path(title="The ID of the item to get")): 1abc

8 results = {"item_id": item_id} 1def

9 if q: 1def

10 results.update({"q": q}) 1def

11 return results 1def