Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for value_error (0.06 sec)

  1. tests/test_filter_pydantic_sub_model_pv2.py

            client.get("/model/modelX")
        assert err.value.errors() == [
            {
                "type": "value_error",
                "loc": ("response", "name"),
                "msg": "Value error, name must end in A",
                "input": "modelX",
                "ctx": {"error": HasRepr("ValueError('name must end in A')")},
            }
        ]
    
    
    def test_openapi_schema(client: TestClient):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.6K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py

        assert response.status_code == 422, response.text
        assert response.json() == snapshot(
            {
                "detail": [
                    {
                        "type": "value_error",
                        "loc": ["query", "id"],
                        "msg": 'Value error, Invalid ID format, it must start with "isbn-" or "imdb-"',
                        "input": "wtf-yes",
                        "ctx": {"error": {}},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 5K bytes
    - Viewed (0)
  3. docs/zh/docs/tutorial/query-params.md

    ```JSON
    {
        "detail": [
            {
                "loc": [
                    "query",
                    "needy"
                ],
                "msg": "field required",
                "type": "value_error.missing"
            }
        ]
    }
    ```
    
    `needy` 是必选参数,因此要在 URL 中设置值:
    
    ```
    http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
    ```
    
    ……这样就正常了:
    
    ```JSON
    {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  4. docs/ko/docs/tutorial/query-params.md

    ```JSON
    {
        "detail": [
            {
                "loc": [
                    "query",
                    "needy"
                ],
                "msg": "field required",
                "type": "value_error.missing"
            }
        ]
    }
    ```
    
    `needy`는 필수 매개변수이므로 URL에 반드시 설정해줘야 합니다:
    
    ```
    http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
    ```
    
    ...아래처럼 작동합니다:
    
    ```JSON
    {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  5. docs/fr/docs/tutorial/query-params.md

    ```JSON
    {
        "detail": [
            {
                "loc": [
                    "query",
                    "needy"
                ],
                "msg": "field required",
                "type": "value_error.missing"
            }
        ]
    }
    ```
    
    La présence de `needy` étant nécessaire, vous auriez besoin de l'insérer dans l'URL :
    
    ```
    http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
    ```
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Nov 09 16:39:20 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  6. docs/ja/docs/tutorial/query-params.md

    ```JSON
    {
        "detail": [
            {
                "loc": [
                    "query",
                    "needy"
                ],
                "msg": "field required",
                "type": "value_error.missing"
            }
        ]
    }
    ```
    
    `needy` は必須のパラメータなので、URLにセットする必要があります:
    
    ```
    http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
    ```
    
    ...これはうまくいくでしょう:
    
    ```JSON
    {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 5.4K bytes
    - Viewed (0)
  7. tests/test_dependency_after_yield_raise.py

        try:
            yield "s"
        except CustomError as err:
            raise HTTPException(status_code=418, detail="Session error") from err
    
    
    def broken_dep() -> Any:
        yield "s"
        raise ValueError("Broken after yield")
    
    
    app = FastAPI()
    
    
    @app.get("/catching")
    def catching(d: Annotated[str, Depends(catching_dep)]) -> Any:
        raise CustomError("Simulated error during streaming")
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  8. tests/test_exception_handlers.py

            RequestValidationError: request_validation_exception_handler,
            Exception: server_error_exception_handler,
        }
    )
    
    client = TestClient(app)
    
    
    def raise_value_error():
        raise ValueError()
    
    
    def dependency_with_yield():
        yield raise_value_error()
    
    
    @app.get("/dependency-with-yield", dependencies=[Depends(dependency_with_yield)])
    def with_yield(): ...
    
    
    @app.get("/http-exception")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 03 22:37:12 UTC 2024
    - 2.4K bytes
    - Viewed (0)
  9. tests/test_additional_responses_bad.py

                "get": {
                    "responses": {
                        # this is how one would imagine the openapi schema to be
                        # but since the key is not valid, openapi.utils.get_openapi will raise ValueError
                        "hello": {"description": "Not a valid additional response"},
                        "200": {
                            "description": "Successful Response",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  10. tests/test_dependency_after_yield_streaming.py

        assert response.status_code == 500
        assert response.text == "Internal Server Error"
    
    
    def test_broken_session_stream_raise():
        # Can raise ValueError on Pydantic v2 and ExceptionGroup on Pydantic v1
        with pytest.raises((ValueError, Exception)):
            client.get("/broken-session-stream")
    
    
    def test_broken_session_stream_no_raise():
        """
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 3.2K bytes
    - Viewed (0)
Back to top