mirror of https://github.com/tiangolo/fastapi.git
✅ Tweak Python 3.10-only test to not break below 3.10
This commit is contained in:
parent
61ef22512e
commit
6b68de7f42
|
|
@ -6,22 +6,20 @@ from typing_extensions import Annotated
|
||||||
|
|
||||||
from .utils import needs_py310
|
from .utils import needs_py310
|
||||||
|
|
||||||
|
|
||||||
|
@needs_py310
|
||||||
|
def test_stringified_annotations():
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
|
|
||||||
|
|
||||||
class Dep:
|
class Dep:
|
||||||
def __call__(self, request: Request):
|
def __call__(self, request: Request):
|
||||||
return "test"
|
return "test"
|
||||||
|
|
||||||
|
|
||||||
@app.get("/test/")
|
@app.get("/test/")
|
||||||
def call(test: Annotated[str, Depends(Dep())]):
|
def call(test: Annotated[str, Depends(Dep())]):
|
||||||
return {"test": test}
|
return {"test": test}
|
||||||
|
|
||||||
|
|
||||||
@needs_py310
|
|
||||||
def test_stringified_annotations():
|
|
||||||
response = client.get("/test")
|
response = client.get("/test")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue