mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-18 05:15:46 -04:00
📝 Update source examples and docs from Python 3.9 to 3.10 (#14900)
This commit is contained in:
committed by
GitHub
parent
d06ab3f5c7
commit
c9e2277d8b
0
docs_src/async_tests/app_a_py310/__init__.py
Normal file
0
docs_src/async_tests/app_a_py310/__init__.py
Normal file
8
docs_src/async_tests/app_a_py310/main.py
Normal file
8
docs_src/async_tests/app_a_py310/main.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"message": "Tomato"}
|
||||
14
docs_src/async_tests/app_a_py310/test_main.py
Normal file
14
docs_src/async_tests/app_a_py310/test_main.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from .main import app
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_root():
|
||||
async with AsyncClient(
|
||||
transport=ASGITransport(app=app), base_url="http://test"
|
||||
) as ac:
|
||||
response = await ac.get("/")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"message": "Tomato"}
|
||||
Reference in New Issue
Block a user