Coverage for docs_src / body / tutorial003_py310.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from fastapi import FastAPI 1abfgcde

2from pydantic import BaseModel 1abfgcde

3 

4 

5class Item(BaseModel): 1abfgcde

6 name: str 1abcde

7 description: str | None = None 1abfgcde

8 price: float 1abcde

9 tax: float | None = None 1abfgcde

10 

11 

12app = FastAPI() 1abfgcde

13 

14 

15@app.put("/items/{item_id}") 1abfgcde

16async def update_item(item_id: int, item: Item): 1abfgcde

17 return {"item_id": item_id, **item.model_dump()} 1hijklmno