diff --git a/tests/test_litellm/images/test_image_edit_utils.py b/tests/test_litellm/images/test_image_edit_utils.py index fa42ad8e0ea..45b31ee196b 100644 --- a/tests/test_litellm/images/test_image_edit_utils.py +++ b/tests/test_litellm/images/test_image_edit_utils.py @@ -60,6 +60,80 @@ class _NonSeekableStream(io.BytesIO): return False +class _FailingReadStream(io.BytesIO): + def read(self, size: int = -1) -> bytes: + raise OSError("simulated disk read failure") + + +def _jpeg_sof_segment(marker: int, width: int, height: int) -> bytes: + return bytes((0xFF, marker)) + struct.pack(">H", 17) + struct.pack(">BHH", 8, height, width) + + +def _jpeg_segment(marker: int, payload: bytes) -> bytes: + return bytes((0xFF, marker)) + struct.pack(">H", len(payload) + 2) + payload + + +def _webp_chunk(fourcc: bytes, body: bytes) -> bytes: + chunk: Final = fourcc + struct.pack("