Coverage for tests / test_stringified_annotation_dependency_py314.py: 100%
15 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from typing import TYPE_CHECKING, Annotated 1bcde
3from fastapi import Depends, FastAPI 1bcde
4from fastapi.testclient import TestClient 1bcde
6from .utils import needs_py314 1bcde
8if TYPE_CHECKING: # pragma: no cover 1bcde
10 class DummyUser: ...
13@needs_py314 1bcde
14def test_stringified_annotation(): 1bcde
15 # python3.14: Use forward reference without "from __future__ import annotations"
16 async def get_current_user() -> DummyUser | None: 1a
17 return None 1a
19 app = FastAPI() 1a
21 client = TestClient(app) 1a
23 @app.get("/") 1a
24 async def get( 1a
25 current_user: Annotated[DummyUser | None, Depends(get_current_user)],
26 ) -> str:
27 return "hello world" 1a
29 response = client.get("/") 1a
30 assert response.status_code == 200 1a