Coverage for docs_src/app_testing/tutorial001.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from fastapi import FastAPI 1abcde
2from fastapi.testclient import TestClient 1abcde
4app = FastAPI() 1abcde
7@app.get("/") 1abcde
8async def read_main(): 1abcde
9 return {"msg": "Hello World"} 1abcde
12client = TestClient(app) 1abcde
15def test_read_main(): 1abcde
16 response = client.get("/") 1abcde
17 assert response.status_code == 200 1abcde
18 assert response.json() == {"msg": "Hello World"} 1abcde