Coverage for tests / test_stringified_annotations_simple.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +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): 1abecd

13 return "test" 1feg

14 

15 

16@needs_py310 1abcd

17def test_stringified_annotations(): 1abcd

18 app = FastAPI() 1feg

19 

20 client = TestClient(app) 1feg

21 

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

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

24 return {"test": test} 1feg

25 

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

27 assert response.status_code == 200 1feg