From 30324ce03b2e7ff7865e5b3401427ae04ec53b09 Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 29 Jul 2026 00:38:27 +0000 Subject: [PATCH] test(agentfield): add regression test for issue #587 Ref: #587 Signed-off-by: Jay --- tests/test_issue_587.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/test_issue_587.py diff --git a/tests/test_issue_587.py b/tests/test_issue_587.py new file mode 100644 index 00000000..5b434be7 --- /dev/null +++ b/tests/test_issue_587.py @@ -0,0 +1,18 @@ +"""Regression test for issue #587 -- ImageOutput.save() with data URLs.""" + +import base64 + +from agentfield.multimodal_response import ImageOutput + + +def test_issue_587(tmp_path): + """Gemini-style data URLs should save locally without an HTTP request.""" + image_bytes = b"\x89PNG\r\n\x1a\nissue-587" + image = ImageOutput( + url=f"data:image/png;base64,{base64.b64encode(image_bytes).decode()}" + ) + output_path = tmp_path / "gemini-image.png" + + image.save(output_path) + + assert output_path.read_bytes() == image_bytes