Coverage for docs_src / dependencies / tutorial011_an_py310.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from typing import Annotated 1abc
3from fastapi import Depends, FastAPI 1abc
5app = FastAPI() 1abc
8class FixedContentQueryChecker: 1abc
9 def __init__(self, fixed_content: str): 1abc
10 self.fixed_content = fixed_content 1abc
12 def __call__(self, q: str = ""): 1abc
13 if q: 1def
14 return self.fixed_content in q 1def
15 return False 1def
18checker = FixedContentQueryChecker("bar") 1abc
21@app.get("/query-checker/") 1abc
22async def read_query_check(fixed_content_included: Annotated[bool, Depends(checker)]): 1abc
23 return {"fixed_content_in_query": fixed_content_included} 1def