Coverage for docs_src / query_params / tutorial004_py310.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from fastapi import FastAPI 1def
3app = FastAPI() 1def
6@app.get("/users/{user_id}/items/{item_id}") 1def
7async def read_user_item( 1def
8 user_id: int, item_id: str, q: str | None = None, short: bool = False
9):
10 item = {"item_id": item_id, "owner_id": user_id} 1abc
11 if q: 1abc
12 item.update({"q": q}) 1abc
13 if not short: 1abc
14 item.update( 1abc
15 {"description": "This is an amazing item that has a long description"}
16 )
17 return item 1abc