Coverage for docs_src / dependencies / tutorial011_py310.py: 100%
13 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 fastapi import Depends, FastAPI 1abc
3app = FastAPI() 1abc
6class FixedContentQueryChecker: 1abc
7 def __init__(self, fixed_content: str): 1abc
8 self.fixed_content = fixed_content 1abc
10 def __call__(self, q: str = ""): 1abc
11 if q: 1def
12 return self.fixed_content in q 1def
13 return False 1def
16checker = FixedContentQueryChecker("bar") 1abc
19@app.get("/query-checker/") 1abc
20async def read_query_check(fixed_content_included: bool = Depends(checker)): 1abc
21 return {"fixed_content_in_query": fixed_content_included} 1def