mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
feat: add option to disable shell command suggestions
This commit is contained in:
parent
825a94f7f0
commit
6f85f38d47
3 changed files with 35 additions and 47 deletions
|
@ -776,7 +776,38 @@ This command will print 'Hello, World!' to the console."""
|
|||
self.assertEqual(coder.shell_commands[0].strip(), 'echo "Hello, World!"')
|
||||
|
||||
# Check if handle_shell_commands was called with the correct argument
|
||||
coder.handle_shell_commands.assert_called_once_with('echo "Hello, World!"', ANY)
|
||||
coder.handle_shell_commands.assert_called_once()
|
||||
|
||||
def test_no_suggest_shell_commands(self):
|
||||
with GitTemporaryDirectory():
|
||||
io = InputOutput(yes=True)
|
||||
coder = Coder.create(self.GPT35, "diff", io=io, suggest_shell_commands=False)
|
||||
|
||||
def mock_send(*args, **kwargs):
|
||||
coder.partial_response_content = """Here's a shell command to run:
|
||||
|
||||
```bash
|
||||
echo "Hello, World!"
|
||||
```
|
||||
|
||||
This command will print 'Hello, World!' to the console."""
|
||||
coder.partial_response_function_call = dict()
|
||||
return []
|
||||
|
||||
coder.send = mock_send
|
||||
|
||||
# Mock the handle_shell_commands method to check if it's called
|
||||
coder.handle_shell_commands = MagicMock()
|
||||
|
||||
# Run the coder with a message
|
||||
coder.run(with_message="Suggest a shell command")
|
||||
|
||||
# Check if the shell command was added to the list
|
||||
self.assertEqual(len(coder.shell_commands), 1)
|
||||
self.assertEqual(coder.shell_commands[0].strip(), 'echo "Hello, World!"')
|
||||
|
||||
# Check if handle_shell_commands was called with the correct argument
|
||||
coder.handle_shell_commands.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue