Skip to content

Commit 30324ce

Browse files
author
Jay
committed
test(agentfield): add regression test for issue #587
Ref: #587 Signed-off-by: Jay <sallomondiei@gmail.com>
1 parent 576bc0c commit 30324ce

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_issue_587.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Regression test for issue #587 -- ImageOutput.save() with data URLs."""
2+
3+
import base64
4+
5+
from agentfield.multimodal_response import ImageOutput
6+
7+
8+
def test_issue_587(tmp_path):
9+
"""Gemini-style data URLs should save locally without an HTTP request."""
10+
image_bytes = b"\x89PNG\r\n\x1a\nissue-587"
11+
image = ImageOutput(
12+
url=f"data:image/png;base64,{base64.b64encode(image_bytes).decode()}"
13+
)
14+
output_path = tmp_path / "gemini-image.png"
15+
16+
image.save(output_path)
17+
18+
assert output_path.read_bytes() == image_bytes

0 commit comments

Comments
 (0)