Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 1,926 for App (0.01 sec)

  1. 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)
  2. tests/test_dependency_security_overrides.py

            "scopes": ["foo", "bar"],
            "data": [3, 4, 5],
        }
        app.dependency_overrides = {}
    
    
    def test_override_security():
        app.dependency_overrides[get_user] = get_user_override
        response = client.get("/user")
        assert response.json() == {
            "user": "alice",
            "scopes": ["foo", "bar"],
            "data": [1, 2, 3],
        }
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.4K bytes
    - Viewed (1)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. tests/test_router_redirect_slashes.py

    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_redirect_slashes_enabled():
        app = FastAPI()
        router = APIRouter()
    
        @router.get("/hello/")
        def hello_page() -> str:
            return "Hello, World!"
    
        app.include_router(router)
    
        client = TestClient(app)
    
        response = client.get("/hello/", follow_redirects=False)
        assert response.status_code == 200
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Jun 22 10:37:50 UTC 2023
    - 974 bytes
    - Viewed (0)
  8. tests/test_response_by_alias.py

    
    @app.get("/by-alias/dict", response_model=Model)
    def by_alias_dict():
        return {"alias": "Foo"}
    
    
    @app.get("/by-alias/model", response_model=Model)
    def by_alias_model():
        return Model(alias="Foo")
    
    
    @app.get("/by-alias/list", response_model=list[Model])
    def by_alias_list():
        return [{"alias": "Foo"}, {"alias": "Bar"}]
    
    
    @app.get("/no-alias/dict", response_model=ModelNoAlias)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 10.7K bytes
    - Viewed (0)
  9. tests/test_skip_defaults.py

        y: str = "y"
        z: str = "z"
    
    
    @app.get("/", response_model=Model, response_model_exclude_unset=True)
    def get_root() -> ModelSubclass:
        return ModelSubclass(sub={}, y=1, z=0)
    
    
    @app.get(
        "/exclude_unset", response_model=ModelDefaults, response_model_exclude_unset=True
    )
    def get_exclude_unset() -> ModelDefaults:
        return ModelDefaults(x=None, y="y")
    
    
    @app.get(
        "/exclude_defaults",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 2K bytes
    - Viewed (0)
  10. tests/test_validate_response.py

    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[list[int]] = None
    
    
    @app.get("/items/invalid", response_model=Item)
    def get_invalid():
        return {"name": "invalid", "price": "foo"}
    
    
    @app.get("/items/invalidnone", response_model=Item)
    def get_invalid_none():
        return None
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2K bytes
    - Viewed (0)
Back to top