Coverage for tests / test_callable_endpoint.py: 100%

13 statements  

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

1from functools import partial 1abcd

2 

3from fastapi import FastAPI 1abcd

4from fastapi.testclient import TestClient 1abcd

5 

6 

7def main(some_arg, q: str | None = None): 1abcd

8 return {"some_arg": some_arg, "q": q} 1efgh

9 

10 

11endpoint = partial(main, "foo") 1abcd

12 

13app = FastAPI() 1abcd

14 

15app.get("/")(endpoint) 1abcd

16 

17 

18client = TestClient(app) 1abcd

19 

20 

21def test_partial(): 1abcd

22 response = client.get("/?q=bar") 1efgh

23 data = response.json() 1efgh

24 assert data == {"some_arg": "foo", "q": "bar"} 1efgh