mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
tests pass on windows
This commit is contained in:
parent
76eb9e020f
commit
9aaee49c51
1 changed files with 120 additions and 135 deletions
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
@ -11,14 +12,14 @@ from aider.io import InputOutput
|
|||
class TestWholeFileCoder(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.original_cwd = os.getcwd()
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
os.chdir(self.tempdir)
|
||||
|
||||
def tearDown(self):
|
||||
os.chdir(self.original_cwd)
|
||||
shutil.rmtree(self.tempdir, ignore_errors=True)
|
||||
|
||||
def test_update_files(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
|
||||
# Create a sample file in the temporary directory
|
||||
sample_file = "sample.txt"
|
||||
with open(sample_file, "w") as f:
|
||||
|
@ -43,9 +44,6 @@ class TestWholeFileCoder(unittest.TestCase):
|
|||
self.assertEqual(updated_content, "Updated content\n")
|
||||
|
||||
def test_update_files_with_existing_fence(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
|
||||
# Create a sample file in the temporary directory
|
||||
sample_file = "sample.txt"
|
||||
original_content = """
|
||||
|
@ -82,9 +80,6 @@ Quote!
|
|||
self.assertEqual(updated_content, "Updated content\n")
|
||||
|
||||
def test_update_files_bogus_path_prefix(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
|
||||
# Create a sample file in the temporary directory
|
||||
sample_file = "sample.txt"
|
||||
with open(sample_file, "w") as f:
|
||||
|
@ -110,9 +105,6 @@ Quote!
|
|||
self.assertEqual(updated_content, "Updated content\n")
|
||||
|
||||
def test_update_files_not_in_chat(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
|
||||
# Create a sample file in the temporary directory
|
||||
sample_file = "sample.txt"
|
||||
with open(sample_file, "w") as f:
|
||||
|
@ -137,9 +129,6 @@ Quote!
|
|||
self.assertEqual(updated_content, "Updated content\n")
|
||||
|
||||
def test_update_files_no_filename_single_file_in_chat(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
|
||||
sample_file = "accumulate.py"
|
||||
content = (
|
||||
"def accumulate(collection, operation):\n return [operation(x) for x in"
|
||||
|
@ -173,10 +162,6 @@ Quote!
|
|||
self.assertEqual(updated_content, content)
|
||||
|
||||
def test_update_files_earlier_filename(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
print(temp_dir)
|
||||
|
||||
fname_a = Path("a.txt")
|
||||
fname_b = Path("b.txt")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue