♻️ Refactor test names and files to simplify

This commit is contained in:
Sebastián Ramírez 2025-12-03 12:36:28 +01:00
parent 088b157a98
commit 145d1de598
4 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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)

View File

@ -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