mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 13:54:59 +00:00
fixed tests
This commit is contained in:
parent
f7ccdaa914
commit
d58e5421b0
2 changed files with 6 additions and 5 deletions
|
@ -5,12 +5,13 @@ from unittest.mock import MagicMock, patch
|
||||||
import openai
|
import openai
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from aider.coder import Coder
|
from aider import models
|
||||||
|
from aider.coders import Coder
|
||||||
|
|
||||||
|
|
||||||
class TestCoder(unittest.TestCase):
|
class TestCoder(unittest.TestCase):
|
||||||
def setUp(self):
|
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 = self.patcher.start()
|
||||||
self.mock_check.return_value = True
|
self.mock_check.return_value = True
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ class TestCoder(unittest.TestCase):
|
||||||
# Assert that the returned message is the expected one
|
# Assert that the returned message is the expected one
|
||||||
self.assertEqual(result, 'a good "commit message"')
|
self.assertEqual(result, 'a good "commit message"')
|
||||||
|
|
||||||
@patch("aider.coder.openai.ChatCompletion.create")
|
@patch("aider.coders.base.openai.ChatCompletion.create")
|
||||||
@patch("builtins.print")
|
@patch("builtins.print")
|
||||||
def test_send_with_retries_rate_limit_error(self, mock_print, mock_chat_completion_create):
|
def test_send_with_retries_rate_limit_error(self, mock_print, mock_chat_completion_create):
|
||||||
# Mock the IO object
|
# Mock the IO object
|
||||||
|
@ -142,7 +143,7 @@ class TestCoder(unittest.TestCase):
|
||||||
# Assert that print was called once
|
# Assert that print was called once
|
||||||
mock_print.assert_called_once()
|
mock_print.assert_called_once()
|
||||||
|
|
||||||
@patch("aider.coder.openai.ChatCompletion.create")
|
@patch("aider.coders.base.openai.ChatCompletion.create")
|
||||||
@patch("builtins.print")
|
@patch("builtins.print")
|
||||||
def test_send_with_retries_connection_error(self, mock_print, mock_chat_completion_create):
|
def test_send_with_retries_connection_error(self, mock_print, mock_chat_completion_create):
|
||||||
# Mock the IO object
|
# Mock the IO object
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from aider import utils
|
import aider.coders.editblock as utils
|
||||||
|
|
||||||
|
|
||||||
class TestUtils(unittest.TestCase):
|
class TestUtils(unittest.TestCase):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue