test: update test_sendchat to use Model class and fix assertion

This commit is contained in:
Paul Gauthier 2024-12-07 15:07:39 -08:00 committed by Paul Gauthier (aider)
parent a56fa567dd
commit a74cdbfc28

View file

@ -3,6 +3,7 @@ from unittest.mock import MagicMock, patch
from aider.exceptions import LiteLLMExceptions from aider.exceptions import LiteLLMExceptions
from aider.llm import litellm from aider.llm import litellm
from aider.models import Model
from aider.sendchat import send_completion, simple_send_with_retries from aider.sendchat import send_completion, simple_send_with_retries
@ -37,9 +38,8 @@ class TestSendChat(unittest.TestCase):
] ]
# Call the simple_send_with_retries method # Call the simple_send_with_retries method
simple_send_with_retries(self.mock_model, self.mock_messages) simple_send_with_retries(Model(self.mock_model), self.mock_messages)
# Should print: error message, description (if any), and retry message assert mock_print.call_count == 3
assert mock_print.call_count == 2 # Error message + retry message
@patch("litellm.completion") @patch("litellm.completion")
def test_send_completion_basic(self, mock_completion): def test_send_completion_basic(self, mock_completion):