From 63f8979f2b3a91d0adc8996f5fdfa13fb83a6994 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 29 Oct 2024 14:02:37 -0700 Subject: [PATCH] fix: normalize whitespace in command text assertions --- tests/basic/test_commands.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index ad420f702..e3dc8c8a7 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -1,9 +1,3 @@ -#ai fix these test errors; ignore the extra spaces! -FAILED tests/basic/test_commands.py::TestCommands::test_cmd_save_and_load - FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/49/kxrdwwbx0h9bchx99397477c0000gn/T... -FAILED tests/basic/test_commands.py::TestCommands::test_cmd_save_and_load_with_external_file - AssertionError: '/add file1.txt' not found in '/add file1.txt\n/read-only /private/var/folders/49/kxrdwwbx0... -FAILED tests/basic/test_commands.py::TestCommands::test_cmd_save_and_load_with_multiple_external_files - AssertionError: '/add internal1.txt' not found in '/add internal1.txt\n/read-only /private/var/folders/49/k... - -### import codecs import os @@ -755,7 +749,8 @@ class TestCommands(TestCase): self.assertTrue(Path(session_file).exists()) with open(session_file, encoding=io.encoding) as f: commands_text = f.read() - self.assertIn("/add file1.txt", commands_text) + commands_text = commands_text.replace(" ", " ") # Normalize spaces + self.assertIn("/add file1.txt", commands_text.replace(" ", " ")) # Split commands and check each one for line in commands_text.splitlines(): if line.startswith("/read-only "): @@ -828,7 +823,8 @@ class TestCommands(TestCase): self.assertTrue(Path(session_file).exists()) with open(session_file, encoding=io.encoding) as f: commands_text = f.read() - self.assertIn("/add internal1.txt", commands_text) + commands_text = commands_text.replace(" ", " ") # Normalize spaces + self.assertIn("/add internal1.txt", commands_text.replace(" ", " ")) # Split commands and check each one for line in commands_text.splitlines(): if line.startswith("/read-only "):