Coverage for tests / test_stringified_annotations_simple.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from __future__ import annotations 1abcd

2 

3from typing import Annotated 1abcd

4 

5from fastapi import Depends, FastAPI, Request 1abcd

6from fastapi.testclient import TestClient 1abcd

7 

8from .utils import needs_py310 1abcd

9 

10 

11class Dep: 1abcd

12 def __call__(self, request: Request): 1abcd

13 return "test" 1efgh

14 

15 

16@needs_py310 1abcd

17def test_stringified_annotations(): 1abcd

18 app = FastAPI() 1efgh

19 

20 client = TestClient(app) 1efgh

21 

22 @app.get("/test/") 1efgh

23 def call(test: Annotated[str, Depends(Dep())]): 1efgh

24 return {"test": test} 1efgh

25 

26 response = client.get("/test") 1efgh

27 assert response.status_code == 200 1efgh