mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 21:34:59 +00:00
working test
This commit is contained in:
parent
b4f78547bc
commit
d00e7c39d1
1 changed files with 8 additions and 4 deletions
|
@ -1,11 +1,12 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from aider import models
|
||||
from aider.coders.wholefile_coder import WholeFileCoder
|
||||
from aider.io import InputOutput
|
||||
|
||||
|
||||
class TestWholeFileCoder(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.original_cwd = os.getcwd()
|
||||
|
@ -15,14 +16,16 @@ class TestWholeFileCoder(unittest.TestCase):
|
|||
|
||||
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 = os.path.join(temp_dir, "sample.txt")
|
||||
sample_file = "sample.txt"
|
||||
with open(sample_file, "w") as f:
|
||||
f.write("Original content\n")
|
||||
|
||||
# Initialize WholeFileCoder with the temporary directory
|
||||
io = InputOutput(yes=yes)
|
||||
coder = WholeFileCoder(root=temp_dir, io=io)
|
||||
io = InputOutput(yes=True)
|
||||
coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
|
||||
|
||||
# Set the partial response content with the updated content
|
||||
coder.partial_response_content = f"{sample_file}\n```\nUpdated content\n```"
|
||||
|
@ -38,5 +41,6 @@ class TestWholeFileCoder(unittest.TestCase):
|
|||
updated_content = f.read()
|
||||
self.assertEqual(updated_content, "Updated content\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue