Tweak Python 3.10-only test to not break below 3.10

This commit is contained in:
Sebastián Ramírez 2025-12-03 14:38:48 +01:00
parent 61ef22512e
commit 6b68de7f42
1 changed files with 12 additions and 14 deletions

View File

@ -6,22 +6,20 @@ from typing_extensions import Annotated
from .utils import needs_py310
app = FastAPI()
client = TestClient(app)
class Dep:
def __call__(self, request: Request):
return "test"
@app.get("/test/")
def call(test: Annotated[str, Depends(Dep())]):
return {"test": test}
@needs_py310
def test_stringified_annotations():
app = FastAPI()
client = TestClient(app)
class Dep:
def __call__(self, request: Request):
return "test"
@app.get("/test/")
def call(test: Annotated[str, Depends(Dep())]):
return {"test": test}
response = client.get("/test")
assert response.status_code == 200