Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 14 for value_error (0.06 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  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):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 6.7K bytes
    - Click Count (0)
  2. 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():
        """
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 3.2K bytes
    - Click Count (0)
  3. scripts/doc_parsing_utils.py

        Syntax of comments depends on the language of the code block.
        Raises ValueError if the blocks are not compatible (different languages or different number of lines).
        """
    
        start_line = block_a["start_line_no"]
        end_line_no = start_line + len(block_a["content"]) - 1
    
        if block_a["lang"] != block_b["lang"]:
            raise ValueError(
                f"Code block (lines {start_line}-{end_line_no}) "
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:37:41 GMT 2026
    - 23.5K bytes
    - Click Count (0)
  4. tests/test_openapi_schema_type.py

        schema = Schema(type=type_value)
        assert schema.type == type_value
    
    
    def test_invalid_type_value() -> None:
        """Test that Schema raises ValueError for invalid type values."""
        with pytest.raises(ValueError, match="2 validation errors for Schema"):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 685 bytes
    - Click Count (0)
  5. 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")
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.7K bytes
    - Click Count (0)
  6. tests/test_dependency_after_yield_websockets.py

            self.open = True
    
        def __iter__(self) -> Generator[str, None, None]:
            for item in self.data:
                if self.open:
                    yield item
                else:
                    raise ValueError("Session closed")
    
    
    @contextmanager
    def acquire_session() -> Generator[Session, None, None]:
        session = Session()
        try:
            yield session
        finally:
            session.open = False
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 2K bytes
    - Click Count (0)
  7. tests/test_sse.py

    def test_server_sent_event_null_id_rejected():
        with pytest.raises(ValueError, match="null"):
            ServerSentEvent(data="test", id="has\0null")
    
    
    def test_server_sent_event_negative_retry_rejected():
        with pytest.raises(ValueError):
            ServerSentEvent(data="test", retry=-1)
    
    
    def test_server_sent_event_float_retry_rejected():
        with pytest.raises(ValueError):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 9.8K bytes
    - Click Count (0)
  8. fastapi/sse.py

        """
    
        media_type = "text/event-stream"
    
    
    def _check_id_no_null(v: str | None) -> str | None:
        if v is not None and "\0" in v:
            raise ValueError("SSE 'id' must not contain null characters")
        return v
    
    
    class ServerSentEvent(BaseModel):
        """Represents a single Server-Sent Event.
    
        When `yield`ed from a *path operation function* that uses
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 6.2K bytes
    - Click Count (0)
  9. 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")
        assert placeholder_1 == placeholder_2
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 1.8K bytes
    - Click Count (0)
  10. scripts/translation_fixer.py

            )
    
            # Write back the fixed document
            doc_lines.append("")  # Ensure file ends with a newline
            path.write_text("\n".join(doc_lines), encoding="utf-8")
    
        except ValueError as e:
            print(f"Error processing {path}: {e}")
            return False
        return True
    
    
    @cli.command()
    def fix_all(ctx: typer.Context, language: str):
        docs = get_all_paths(language)
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Jan 10 21:48:08 GMT 2026
    - 3.2K bytes
    - Click Count (0)
Back to Top