mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 21:04:59 +00:00
refactor: use regex to normalize /add command spaces in tests
This commit is contained in:
parent
3df3d86295
commit
94a49e601c
1 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -748,8 +749,8 @@ class TestCommands(TestCase):
|
||||||
self.assertTrue(Path(session_file).exists())
|
self.assertTrue(Path(session_file).exists())
|
||||||
with open(session_file, encoding=io.encoding) as f:
|
with open(session_file, encoding=io.encoding) as f:
|
||||||
commands_text = f.read()
|
commands_text = f.read()
|
||||||
commands_text = commands_text.replace(" ", " ") # Normalize spaces
|
commands_text = re.sub(r'/add +', '/add ', commands_text) # Normalize add command spaces
|
||||||
self.assertIn("/add file1.txt", commands_text.replace(" ", " "))
|
self.assertIn("/add file1.txt", commands_text)
|
||||||
# Split commands and check each one
|
# Split commands and check each one
|
||||||
for line in commands_text.splitlines():
|
for line in commands_text.splitlines():
|
||||||
if line.startswith("/read-only "):
|
if line.startswith("/read-only "):
|
||||||
|
@ -822,8 +823,8 @@ class TestCommands(TestCase):
|
||||||
self.assertTrue(Path(session_file).exists())
|
self.assertTrue(Path(session_file).exists())
|
||||||
with open(session_file, encoding=io.encoding) as f:
|
with open(session_file, encoding=io.encoding) as f:
|
||||||
commands_text = f.read()
|
commands_text = f.read()
|
||||||
commands_text = commands_text.replace(" ", " ") # Normalize spaces
|
commands_text = re.sub(r'/add +', '/add ', commands_text) # Normalize add command spaces
|
||||||
self.assertIn("/add internal1.txt", commands_text.replace(" ", " "))
|
self.assertIn("/add internal1.txt", commands_text)
|
||||||
# Split commands and check each one
|
# Split commands and check each one
|
||||||
for line in commands_text.splitlines():
|
for line in commands_text.splitlines():
|
||||||
if line.startswith("/read-only "):
|
if line.startswith("/read-only "):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue