Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 31 - 40 of 54 for Cruises (0.15 seconds)

  1. tests/test_dependency_contextvars.py

        The code before yield and the code after yield should be run in the same contextvar
        context, so that request_state_context_var.reset(contextvar_token).
    
        If they are run in a different context, that raises an error.
        """
        response = client.get("/user")
        assert response.json() == "deadpond"
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.5K bytes
    - Click Count (0)
  2. tests/test_tutorial/test_dependencies/test_tutorial008c.py

        assert response.status_code == 200, response.text
        assert response.json() == "plumbus"
    
    
    def test_fastapi_error(mod: ModuleType):
        client = TestClient(mod.app)
        with pytest.raises(FastAPIError) as exc_info:
            client.get("/items/portal-gun")
        assert "raising an exception and a dependency with yield" in exc_info.value.args[0]
    
    
    def test_internal_server_error(mod: ModuleType):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 1.4K bytes
    - Click Count (0)
  3. tests/test_datastructures.py

    import pytest
    from fastapi import FastAPI, UploadFile
    from fastapi.datastructures import Default
    from fastapi.testclient import TestClient
    
    
    def test_upload_file_invalid_pydantic_v2():
        with pytest.raises(ValueError):
            UploadFile._validate("not a Starlette UploadFile", {})
    
    
    def test_default_placeholder_equals():
        placeholder_1 = Default("a")
        placeholder_2 = Default("a")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 1.8K bytes
    - Click Count (0)
  4. tests/test_tutorial/test_websockets/test_tutorial001.py

    
    def test_main():
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<!DOCTYPE html>" in response.content
    
    
    def test_websocket():
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/ws") as websocket:
                message = "Message one"
                websocket.send_text(message)
                data = websocket.receive_text()
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 827 bytes
    - Click Count (0)
  5. tests/test_dependency_after_yield_websockets.py

            data = websocket.receive_text()
            assert data == "bar"
            data = websocket.receive_text()
            assert data == "baz"
    
    
    def test_websocket_dependency_after_yield_broken():
        with pytest.raises(ValueError, match="Session closed"):
            with client.websocket_connect("/ws-broken"):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 2K bytes
    - Click Count (0)
  6. tests/test_inherited_custom_class.py

        def return_fast_uuid():
            asyncpg_uuid = MyUuid("a10ff360-3b1e-4984-a26f-d3ab460bdb51")
            assert isinstance(asyncpg_uuid, uuid.UUID)
            assert type(asyncpg_uuid) is not uuid.UUID
            with pytest.raises(TypeError):
                vars(asyncpg_uuid)
            return {"fast_uuid": asyncpg_uuid}
    
        class SomeCustomClass(BaseModel):
            model_config = {"arbitrary_types_allowed": True}
    
            a_uuid: MyUuid
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 1.8K bytes
    - Click Count (0)
  7. tests/test_filter_pydantic_sub_model_pv2.py

            "description": "model-a-desc",
            "foo": {"username": "test-user"},
            "tags": {"key1": "value1", "key2": "value2"},
        }
    
    
    def test_validator_is_cloned(client: TestClient):
        with pytest.raises(ResponseValidationError) as err:
            client.get("/model/modelX")
        assert err.value.errors() == [
            {
                "type": "value_error",
                "loc": ("response", "name"),
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 6.6K bytes
    - Click Count (0)
  8. tests/test_dependency_yield_scope_websockets.py

        assert data["session_open"] is True
        assert global_state["session_closed"] is True
        assert global_state["named_session_closed"] is True
    
    
    def test_broken_scope() -> None:
        with pytest.raises(
            FastAPIError,
            match='The dependency "get_named_func_session" has a scope of "request", it cannot depend on dependencies with scope "function"',
        ):
    
            @app.websocket("/broken-scope")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 6K bytes
    - Click Count (0)
  9. tests/test_dependency_yield_scope.py

        assert response.status_code == 200
        data = response.json()
        assert data["named_session_open"] is True
        assert data["session_open"] is True
    
    
    def test_broken_scope() -> None:
        with pytest.raises(
            FastAPIError,
            match='The dependency "get_named_func_session" has a scope of "request", it cannot depend on dependencies with scope "function"',
        ):
    
            @app.get("/broken-scope")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 6.7K bytes
    - Click Count (0)
  10. docs/en/docs/tutorial/handling-errors.md

    You can override these exception handlers with your own.
    
    ### Override request validation exceptions { #override-request-validation-exceptions }
    
    When a request contains invalid data, **FastAPI** internally raises a `RequestValidationError`.
    
    And it also includes a default exception handler for it.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 9K bytes
    - Click Count (0)
Back to Top