Coverage for docs_src / body_nested_models / tutorial002_py310.py: 100%
13 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« 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
4app = FastAPI() 1abfgcde
7class Item(BaseModel): 1abfgcde
8 name: str 1abcde
9 description: str | None = None 1abfgcde
10 price: float 1abcde
11 tax: float | None = None 1abfgcde
12 tags: list[str] = [] 1abfgcde
15@app.put("/items/{item_id}") 1abfgcde
16async def update_item(item_id: int, item: Item): 1abfgcde
17 results = {"item_id": item_id, "item": item} 1hijklmn
18 return results 1hijklmn