From 309893fd1e036d53a723022adadbd974ca852baa Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 26 Nov 2024 19:45:01 -0800 Subject: [PATCH] test: verify image file presence in LLM messages for read-only command --- tests/basic/test_commands.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index b4b0e304d..07a82037d 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -903,6 +903,20 @@ class TestCommands(TestCase): ) ) + # Check that the image file appears in the messages + messages = vision_coder.format_messages().all_messages() + found_image = False + for msg in messages: + if msg.get("role") == "user" and "content" in msg: + content = msg["content"] + if isinstance(content, list): + for item in content: + if isinstance(item, dict) and item.get("type") == "text": + if "test_image.jpg" in item.get("text", ""): + found_image = True + break + self.assertTrue(found_image, "Image file not found in messages to LLM") + def test_cmd_read_only_with_glob_pattern(self): with GitTemporaryDirectory() as repo_dir: io = InputOutput(pretty=False, fancy_input=False, yes=False)