From d00e7c39d13fc5db3944b470a018674479c9317c Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 24 Jun 2023 14:37:25 -0700 Subject: [PATCH] working test --- tests/test_wholefile.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_wholefile.py b/tests/test_wholefile.py index 183201514..5b69adb13 100644 --- a/tests/test_wholefile.py +++ b/tests/test_wholefile.py @@ -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()