Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 58 for custom (0.19 sec)

  1. tests/test_inherited_custom_class.py

                return str(v)
    
        @app.get("/get_custom_class")
        def return_some_user():
            # Test that the fix also works for custom pydantic classes
            return SomeCustomClass(a_uuid=MyUuid("b8799909-f914-42de-91bc-95c819218d01"))
    
        client = TestClient(app)
    
        with client:
            response_simple = client.get("/fast_uuid")
            response_pydantic = client.get("/get_custom_class")
    
        assert response_simple.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3K bytes
    - Viewed (0)
  2. tests/test_custom_middleware_exception.py

        return {"message": "OK"}
    
    
    app.include_router(router)
    app.add_middleware(ContentSizeLimitMiddleware, max_content_size=2**8)
    
    
    client = TestClient(app)
    
    
    def test_custom_middleware_exception(tmp_path: Path):
        default_pydantic_max_size = 2**16
        path = tmp_path / "test.txt"
        path.write_bytes(b"x" * (default_pydantic_max_size + 1))
    
        with client:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 25 21:44:40 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  3. tests/test_custom_schema_fields.py

        "x-something-internal": {
            "level": 4,
        },
        "properties": {
            "name": {
                "title": "Name",
                "type": "string",
            }
        },
    }
    
    
    def test_custom_response_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json()["components"]["schemas"]["Item"] == item_schema
    
    
    def test_response():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  4. tests/test_custom_route_class.py

    Sebastián Ramírez <******@****.***> 1688149516 +0200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  5. tests/test_datetime_custom_encoder.py

    Sebastián Ramírez <******@****.***> 1688749933 +0200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.6K bytes
    - Viewed (0)
  6. tests/test_additional_responses_custom_validationerror.py

    Sebastián Ramírez <******@****.***> 1688149516 +0200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.9K bytes
    - Viewed (0)
  7. tests/test_custom_swagger_ui_redirect.py

    Samuel Colvin <******@****.***> 1586320658 +0100
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Apr 08 04:37:38 GMT 2020
    - 1.1K bytes
    - Viewed (0)
  8. tests/test_additional_responses_custom_model_in_callback.py

    Sebastián Ramírez <******@****.***> 1688749933 +0200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  9. tests/test_dependency_contextvars.py

        yield request_state
        legacy_request_state_context_var.reset(contextvar_token)
    
    
    @app.middleware("http")
    async def custom_middleware(
        request: Request, call_next: Callable[[Request], Awaitable[Response]]
    ):
        response = await call_next(request)
        response.headers["custom"] = "foo"
        return response
    
    
    @app.get("/user", dependencies=[Depends(set_up_request_state_dependency)])
    def get_user():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  10. tests/test_ws_router.py

    
    def test_depend_err_handler():
        """
        Verify that it is possible to write custom WebSocket middleware to catch errors
        """
    
        async def custom_handler(websocket: WebSocket, exc: CustomError) -> None:
            await websocket.close(1002, "foo")
    
        myapp = make_app(exception_handlers={CustomError: custom_handler})
        client = TestClient(myapp)
        with pytest.raises(WebSocketDisconnect) as e:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
Back to top