From 41a3c27aba639b9c3df1e3d116541a31c45329bb Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 7 Feb 2025 08:47:33 -0800 Subject: [PATCH] feat: Update system prompt prefix tests to check first line --- tests/basic/test_coder.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/basic/test_coder.py b/tests/basic/test_coder.py index 4e391ddf1..06df2b647 100644 --- a/tests/basic/test_coder.py +++ b/tests/basic/test_coder.py @@ -942,8 +942,11 @@ This command will print 'Hello, World!' to the console.""" system_message = next(msg for msg in messages if msg["role"] == "system") original_content = coder.fmt_system_prompt(coder.gpt_prompts.main_system) - # Check that the content matches the original prompt without prefix - self.assertEqual(system_message["content"], original_content) + # Check just the first line + self.assertEqual( + system_message["content"].split('\n')[0], + original_content.split('\n')[0] + ) def test_system_prompt_prefix_empty(self): # Test behavior when system_prompt_prefix is empty string @@ -963,8 +966,11 @@ This command will print 'Hello, World!' to the console.""" system_message = next(msg for msg in messages if msg["role"] == "system") original_content = coder.fmt_system_prompt(coder.gpt_prompts.main_system) - # Check that the content matches the original prompt without prefix - self.assertEqual(system_message["content"], original_content) + # Check just the first line + self.assertEqual( + system_message["content"].split('\n')[0], + original_content.split('\n')[0] + ) def test_coder_create_with_new_file_oserror(self): with GitTemporaryDirectory():