- Sort Score
- Result 10 results
- Languages All
Results 41 - 50 of 1,800 for App (0.02 sec)
-
tests/test_invalid_sequence_param.py
def test_invalid_sequence(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str @app.get("/items/") def read_items(q: list[Item] = Query(default=None)): pass # pragma: no cover def test_invalid_tuple(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.2K bytes - Viewed (0) -
tests/test_query_cookie_header_model_extra_params.py
from pydantic import BaseModel app = FastAPI() class Model(BaseModel): param: str model_config = {"extra": "allow"} @app.get("/query") async def query_model_with_extra(data: Model = Query()): return data @app.get("/header") async def header_model_with_extra(data: Model = Header()): return data @app.get("/cookie")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 2.3K bytes - Viewed (0) -
tests/test_exception_handlers.py
yield raise_value_error() @app.get("/dependency-with-yield", dependencies=[Depends(dependency_with_yield)]) def with_yield(): ... @app.get("/http-exception") def route_with_http_exception(): raise HTTPException(status_code=400) @app.get("/request-validation/{param}/") def route_with_request_validation_exception(param: int): pass # pragma: no cover @app.get("/server-error")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 03 22:37:12 UTC 2024 - 2.4K bytes - Viewed (0) -
tests/test_request_params/test_form/test_optional_list.py
from fastapi import FastAPI, Form from fastapi.testclient import TestClient from pydantic import BaseModel, Field from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/optional-list-str", operation_id="optional_list_str") async def read_optional_list_str( p: Annotated[Optional[list[str]], Form()] = None, ):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.9K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial003.py
@pytest.fixture( name="app", params=[ "tutorial003_py39", "tutorial003_an_py39", ], ) def get_app(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.request_files.{request.param}") return mod.app @pytest.fixture(name="client") def get_client(app: FastAPI): client = TestClient(app) return client
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 7.5K bytes - Viewed (0) -
tests/test_response_model_include_exclude.py
age: int ref2: Model2 app = FastAPI() @app.get( "/simple_include", response_model=Model2, response_model_include={"baz": ..., "ref": {"foo"}}, ) def simple_include(): return Model2( ref=Model1(foo="simple_include model foo", bar="simple_include model bar"), baz="simple_include model2 baz", ) @app.get( "/simple_include_dict",Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Jul 19 19:14:58 UTC 2021 - 4K bytes - Viewed (0) -
tests/test_generate_unique_id_function.py
return "foo" app = FastAPI(generate_unique_id_function=broken_operation_id) @app.post("/") def post_root(item1: Item): return item1 # pragma: nocover @app.post("/second") def post_second(item1: Item): return item1 # pragma: nocover @app.post("/third") def post_third(item1: Item):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 66.7K bytes - Viewed (0) -
tests/test_validation_error_context.py
def __init__(self): self.exception = None def capture(self, exc): self.exception = exc return exc app = FastAPI() sub_app = FastAPI() captured_exception = ExceptionCapture() app.mount(path="/sub", app=sub_app) @app.exception_handler(RequestValidationError) @sub_app.exception_handler(RequestValidationError)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 06 12:21:57 UTC 2025 - 4.7K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002_py39.py
def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session: yield session app = FastAPI() @app.on_event("startup") def on_startup(): create_db_and_tables() @app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate, session: Session = Depends(get_session)): db_hero = Hero.model_validate(hero)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.6K bytes - Viewed (0) -
docs_src/sql_databases/tutorial001_py39.py
with Session(engine) as session: yield session app = FastAPI() @app.on_event("startup") def on_startup(): create_db_and_tables() @app.post("/heroes/") def create_hero(hero: Hero, session: Session = Depends(get_session)) -> Hero: session.add(hero) session.commit() session.refresh(hero) return hero @app.get("/heroes/") def read_heroes(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 1.8K bytes - Viewed (0)