Coverage for docs_src / events / tutorial002_py310.py: 100%
9 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 1abcd
3app = FastAPI() 1abcd
6@app.on_event("shutdown") 1abcd
7def shutdown_event(): 1abcd
8 with open("log.txt", mode="a") as log: 1eifgjhk
9 log.write("Application shutdown") 1eifgjhk
12@app.get("/items/") 1abcd
13async def read_items(): 1abcd
14 return [{"name": "Foo"}] 1efgh