diff --git a/tests/test_future/__init__.py b/tests/test_stringified_annotations/__init__.py similarity index 100% rename from tests/test_future/__init__.py rename to tests/test_stringified_annotations/__init__.py diff --git a/tests/test_future/test_future_9095.py b/tests/test_stringified_annotations/test_stringified_annotations_simple.py similarity index 74% rename from tests/test_future/test_future_9095.py rename to tests/test_stringified_annotations/test_stringified_annotations_simple.py index 0f59fc7cf..6f0b4b199 100644 --- a/tests/test_future/test_future_9095.py +++ b/tests/test_stringified_annotations/test_stringified_annotations_simple.py @@ -11,16 +11,17 @@ app = FastAPI() client = TestClient(app) -class Test: +class Dep: def __call__(self, request: Request): return "test" -@needs_py310 -def test_call(): - @app.get("/test/") - def call(test: str = Depends(Test())): - return {"test": test} +@app.get("/test/") +def call(test: str = Depends(Dep())): + return {"test": test} + +@needs_py310 +def test_stringified_annotations(): response = client.get("/test") assert response.status_code == 200 diff --git a/tests/test_future/test_future_6465.py b/tests/test_stringified_annotations/test_stringified_annotations_with_import.py similarity index 87% rename from tests/test_future/test_future_6465.py rename to tests/test_stringified_annotations/test_stringified_annotations_with_import.py index f300d6dc6..824f378e3 100644 --- a/tests/test_future/test_future_6465.py +++ b/tests/test_stringified_annotations/test_stringified_annotations_with_import.py @@ -7,7 +7,7 @@ from fastapi.testclient import TestClient from pydantic import BaseModel from ..utils import needs_py310 -from .login_tool import login_required +from .wrapper import wrap app = FastAPI() client = TestClient(app) @@ -21,9 +21,9 @@ class Item(BaseModel): @needs_py310 -def test_future_6465(): +def test_stringified_annotations_import(): @app.get("/items/") - @login_required + @wrap def get_item(item_id: int) -> Item: return Item(name="name", price=42.42) diff --git a/tests/test_future/login_tool.py b/tests/test_stringified_annotations/wrapper.py similarity index 65% rename from tests/test_future/login_tool.py rename to tests/test_stringified_annotations/wrapper.py index e522c7ec8..e7a0a42a2 100644 --- a/tests/test_future/login_tool.py +++ b/tests/test_stringified_annotations/wrapper.py @@ -1,10 +1,9 @@ from functools import wraps -def login_required(func): +def wrap(func): @wraps(func) def wrapper(*args, **kwargs): - # login functionality could come here return func(*args, **kwargs) return wrapper