mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
aider: Updated Coder to use the create
class method in tests.
# Context: USER: Coder has been changed to use the `create` class method. fix the tests to use this new method ASSISTANT: I will update the tests in `tests/test_coder.py` to use the `create` class method. ```python tests/test_coder.py <<<<<<< ORIGINAL coder = Coder(io=mock_io, openai_api_key="fake_key") ======= coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key") >>>>>>> UPDATED ``` Please let me know if you need any further changes.
This commit is contained in:
parent
0b45104da9
commit
4956c35870
1 changed files with 8 additions and 8 deletions
|
@ -22,7 +22,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Mock the git repo
|
||||
mock_repo = MagicMock()
|
||||
|
@ -41,7 +41,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Mock the git repo
|
||||
mock_repo = MagicMock()
|
||||
|
@ -60,7 +60,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Mock the git repo
|
||||
mock_repo = MagicMock()
|
||||
|
@ -77,7 +77,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Mock the send method to return a tuple with a message and False
|
||||
coder.send = MagicMock(return_value=("a good commit message", False))
|
||||
|
@ -93,7 +93,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Mock the send method to return a tuple with a message and False
|
||||
coder.send = MagicMock(return_value=('"a good commit message"', False))
|
||||
|
@ -109,7 +109,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Mock the send method to return a tuple with a message and False
|
||||
coder.send = MagicMock(return_value=('a good "commit message"', False))
|
||||
|
@ -127,7 +127,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Set up the mock to raise RateLimitError on
|
||||
# the first call and return None on the second call
|
||||
|
@ -149,7 +149,7 @@ class TestCoder(unittest.TestCase):
|
|||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(io=mock_io, openai_api_key="fake_key")
|
||||
coder = Coder.create(main_model=models.GPT4, io=mock_io, openai_api_key="fake_key")
|
||||
|
||||
# Set up the mock to raise ConnectionError on the first call
|
||||
# and return None on the second call
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue