mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
fix test
This commit is contained in:
parent
922a56b194
commit
9d2f89dd75
1 changed files with 9 additions and 5 deletions
|
@ -185,12 +185,16 @@ class TestMain(TestCase):
|
|||
def test_message_file_flag(self):
|
||||
message_file_content = "This is a test message from a file."
|
||||
message_file_path = tempfile.mktemp()
|
||||
with open(message_file_path, 'w', encoding='utf-8') as message_file:
|
||||
with open(message_file_path, "w", encoding="utf-8") as message_file:
|
||||
message_file.write(message_file_content)
|
||||
|
||||
with patch("aider.main.Coder.create") as MockCoder:
|
||||
MockCoder.return_value.run = MagicMock()
|
||||
main(["--yes", "--message-file", message_file_path], input=DummyInput(), output=DummyOutput())
|
||||
main(
|
||||
["--yes", "--message-file", message_file_path],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
)
|
||||
MockCoder.return_value.run.assert_called_once_with(with_message=message_file_content)
|
||||
|
||||
os.remove(message_file_path)
|
||||
|
@ -209,12 +213,12 @@ class TestMain(TestCase):
|
|||
MockSend.side_effect = side_effect
|
||||
|
||||
main(["--yes", fname, "--encoding", "iso-8859-15"])
|
||||
|
||||
@patch("aider.main.InputOutput")
|
||||
@patch("openai.ChatCompletion.create")
|
||||
def test_main_message_adds_to_input_history(self, mock_chat_completion, MockInputOutput):
|
||||
@patch("aider.coders.base_coder.Coder.run")
|
||||
def test_main_message_adds_to_input_history(self, mock_run, MockInputOutput):
|
||||
test_message = "test message"
|
||||
mock_io_instance = MockInputOutput.return_value
|
||||
mock_chat_completion.return_value = MagicMock(choices=[{"text": "mocked response"}])
|
||||
|
||||
main(["--message", test_message], input=DummyInput(), output=DummyOutput())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue