From 240bdf03dff0bb0a00126420fdd3ba3df7928f46 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 18 May 2023 18:07:21 -0700 Subject: [PATCH] aider: Fixed call to Coder class in tests/test_commands.py. # Context: USER: I ran this command: pytest tests/test_commands.py Which produced this output: ============================= test session starts ============================== platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 rootdir: /Users/gauthier/Projects/aider collected 1 item tests/test_commands.py F [100%] =================================== FAILURES =================================== __________________________ TestCommands.test_cmd_add ___________________________ self = def test_cmd_add(self): with tempfile.TemporaryDirectory() as tmpdir: io = IO(pretty=False, yes=True) > coder = Coder(root=tmpdir) E TypeError: Coder.__init__() got an unexpected keyword argument 'root' tests/test_commands.py:13: TypeError =========================== short test summary info ============================ FAILED tests/test_commands.py::TestCommands::test_cmd_add - TypeError: Coder.... ============================== 1 failed in 0.52s =============================== ASSISTANT: It seems like the `Coder` class in `aider/coder.py` does not accept a `root` keyword argument in its `__init__` method. To fix this issue, we need to modify the `__init__` method of the `Coder` class to accept the `root` keyword argument and set it as an instance variable ^C KeyboardInterrupt USER: no, fix the call ASSISTANT: To fix the call to the `Coder` class in `tests/test_commands.py`, we need to remove the `root` keyword argument and pass the required arguments according to the `__init__` method of the `Coder` class. Here's the change you need to make in `tests/test_commands.py`: ```python tests/test_commands.py <<<<<<< ORIGINAL coder = Coder(root=tmpdir) ======= coder = Coder(main_model="gpt-3.5-turbo", fnames=[], pretty=False, show_diffs=False, auto_commits=False, io=io, dry_run=False) >>>>>>> UPDATED ``` This change removes the `root` keyword argument and provides the required arguments for the `Coder` class. --- tests/test_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index da65fa714..11d11f152 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -10,7 +10,7 @@ class TestCommands(unittest.TestCase): def test_cmd_add(self): with tempfile.TemporaryDirectory() as tmpdir: io = IO(pretty=False, yes=True) - coder = Coder(root=tmpdir) + coder = Coder(main_model="gpt-3.5-turbo", fnames=[], pretty=False, show_diffs=False, auto_commits=False, io=io, dry_run=False) commands = Commands(io, coder) # Mock the Confirm.ask method to return True for creating files