fix: pre-calculate Windows paths to avoid f-string backslash issues

This commit is contained in:
Paul Gauthier (aider) 2025-03-25 11:05:49 -10:00
parent c67bbe6c00
commit 4716cce208

View file

@ -302,6 +302,7 @@ class TestCoder(unittest.TestCase):
# Pre-format the Windows path to avoid backslash issues in f-string expressions # Pre-format the Windows path to avoid backslash issues in f-string expressions
windows_path = test_files[2].replace("/", "\\") windows_path = test_files[2].replace("/", "\\")
win_path3 = test_files[3].replace('/', '\\')
for fname in test_files: for fname in test_files:
fpath = Path(fname) fpath = Path(fname)
@ -336,7 +337,7 @@ class TestCoder(unittest.TestCase):
( (
f"First, edit `{test_files[0]}`. Then modify {test_files[1]}.\n" f"First, edit `{test_files[0]}`. Then modify {test_files[1]}.\n"
f"```js\n// Update this file\nconst file = '{test_files[2]}';\n```\n" f"```js\n// Update this file\nconst file = '{test_files[2]}';\n```\n"
f"Finally check {test_files[3].replace('/', '\\')}" f"Finally check {win_path3}"
), ),
{test_files[0], test_files[1], test_files[2], test_files[3]}, {test_files[0], test_files[1], test_files[2], test_files[3]},
), ),
@ -347,7 +348,7 @@ class TestCoder(unittest.TestCase):
{test_files[1], test_files[2]}, {test_files[1], test_files[2]},
), ),
( (
f"The file **{test_files[3].replace('/', '\\')}** needs updating", f"The file **{win_path3}** needs updating",
{test_files[3]}, {test_files[3]},
), ),
( (