Coverage for tests/test_stringified_annotations_simple.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-04 08:29 +0000

1from __future__ import annotations 1abcdefg

2 

3from fastapi import Depends, FastAPI, Request 1abcdefg

4from fastapi.testclient import TestClient 1abcdefg

5from typing_extensions import Annotated 1abcdefg

6 

7from .utils import needs_py310 1abcdefg

8 

9 

10class Dep: 1abcdefg

11 def __call__(self, request: Request): 1abcdefgh

12 return "test" 1ijklh

13 

14 

15@needs_py310 1abcdefg

16def test_stringified_annotations(): 1abcdefg

17 app = FastAPI() 1ijklh

18 

19 client = TestClient(app) 1ijklh

20 

21 @app.get("/test/") 1ijklh

22 def call(test: Annotated[str, Depends(Dep())]): 1ijklh

23 return {"test": test} 1ijklh

24 

25 response = client.get("/test") 1ijklh

26 assert response.status_code == 200 1ijklh