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

9 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from datetime import datetime, time, timedelta 1abc

2from uuid import UUID 1abc

3 

4from fastapi import Body, FastAPI 1abc

5 

6app = FastAPI() 1abc

7 

8 

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

10async def read_items( 1abc

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 1abc

18 duration = end_datetime - start_process 1abc

19 return { 1abc

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 }