diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index 992ccf06d..50215f0ff 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -1,5 +1,6 @@ import codecs import os +import re import shutil import sys import tempfile @@ -748,8 +749,8 @@ class TestCommands(TestCase): self.assertTrue(Path(session_file).exists()) with open(session_file, encoding=io.encoding) as f: commands_text = f.read() - commands_text = commands_text.replace(" ", " ") # Normalize spaces - self.assertIn("/add file1.txt", commands_text.replace(" ", " ")) + commands_text = re.sub(r'/add +', '/add ', commands_text) # Normalize add command spaces + self.assertIn("/add file1.txt", commands_text) # Split commands and check each one for line in commands_text.splitlines(): if line.startswith("/read-only "): @@ -822,8 +823,8 @@ class TestCommands(TestCase): self.assertTrue(Path(session_file).exists()) with open(session_file, encoding=io.encoding) as f: commands_text = f.read() - commands_text = commands_text.replace(" ", " ") # Normalize spaces - self.assertIn("/add internal1.txt", commands_text.replace(" ", " ")) + commands_text = re.sub(r'/add +', '/add ', commands_text) # Normalize add command spaces + self.assertIn("/add internal1.txt", commands_text) # Split commands and check each one for line in commands_text.splitlines(): if line.startswith("/read-only "):