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
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1from functools import partial 1abcd
3from fastapi import FastAPI 1abcd
4from fastapi.testclient import TestClient 1abcd
7def main(some_arg, q: str | None = None): 1abcd
8 return {"some_arg": some_arg, "q": q} 1efgh
11endpoint = partial(main, "foo") 1abcd
13app = FastAPI() 1abcd
15app.get("/")(endpoint) 1abcd
18client = TestClient(app) 1abcd
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