# 测试事件:启动 - 关闭
使用 `TestClient` 和 `with` 语句,在测试中运行事件处理器(`startup` 与 `shutdown`)。
{* ../../docs_src/app_testing/tutorial003.py hl[9:12,20:24] *}