fixed tests

This commit is contained in:
Paul Gauthier 2023-06-20 17:36:24 -07:00
parent f7ccdaa914
commit d58e5421b0
2 changed files with 6 additions and 5 deletions

View file

@ -5,12 +5,13 @@ from unittest.mock import MagicMock, patch
import openai
import requests
from aider.coder import Coder
from aider import models
from aider.coders import Coder
class TestCoder(unittest.TestCase):
def setUp(self):
self.patcher = patch("aider.coder.Coder.check_model_availability")
self.patcher = patch("aider.coders.base.check_model_availability")
self.mock_check = self.patcher.start()
self.mock_check.return_value = True
@ -120,7 +121,7 @@ class TestCoder(unittest.TestCase):
# Assert that the returned message is the expected one
self.assertEqual(result, 'a good "commit message"')
@patch("aider.coder.openai.ChatCompletion.create")
@patch("aider.coders.base.openai.ChatCompletion.create")
@patch("builtins.print")
def test_send_with_retries_rate_limit_error(self, mock_print, mock_chat_completion_create):
# Mock the IO object
@ -142,7 +143,7 @@ class TestCoder(unittest.TestCase):
# Assert that print was called once
mock_print.assert_called_once()
@patch("aider.coder.openai.ChatCompletion.create")
@patch("aider.coders.base.openai.ChatCompletion.create")
@patch("builtins.print")
def test_send_with_retries_connection_error(self, mock_print, mock_chat_completion_create):
# Mock the IO object