Coverage for docs_src/extra_data_types/tutorial001_py310.py: 100%

9 statements  

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

1from datetime import datetime, time, timedelta 1abcd

2from uuid import UUID 1abcd

3 

4from fastapi import Body, FastAPI 1abcd

5 

6app = FastAPI() 1abcd

7 

8 

9@app.put("/items/{item_id}") 1abcd

10async def read_items( 1abcd

11 item_id: UUID, 

12 start_datetime: datetime = Body(), 

13 end_datetime: datetime = Body(), 

14 process_after: timedelta = Body(), 

15 repeat_at: time | None = Body(default=None), 

16): 

17 start_process = start_datetime + process_after 1efgh

18 duration = end_datetime - start_process 1efgh

19 return { 1efgh

20 "item_id": item_id, 

21 "start_datetime": start_datetime, 

22 "end_datetime": end_datetime, 

23 "process_after": process_after, 

24 "repeat_at": repeat_at, 

25 "start_process": start_process, 

26 "duration": duration, 

27 }