mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
aider: Set coder.partial_response_content to the good commit message in test_get_commit_message_strip_quotes.
# Context: USER: in `test_get_commit_message_strip_quotes`, the coder.send call needs to just return False. it needs to set coder.partial_response_content= the good commit msg ASSISTANT: To make the requested change, modify the `test_get_commit_message_strip_quotes` method in the `tests/test_coder.py` file as follows: ```python tests/test_coder.py <<<<<<< ORIGINAL # Mock the send method to return a tuple with a message and False coder.send = MagicMock(return_value=('"a good commit message"', False)) ======= # Mock the send method to set partial_response_content and return False def mock_send(*args, **kwargs): coder.partial_response_content = "a good commit message" return False coder.send = MagicMock(side_effect=mock_send) >>>>>>> UPDATED ``` This will replace the original `MagicMock` with a custom `mock_send` function that sets `coder.partial_response_content` to the desired commit message and returns `False`.
This commit is contained in:
parent
2edbaa6e7a
commit
9c79cbbadf
1 changed files with 6 additions and 2 deletions
|
@ -96,8 +96,12 @@ class TestCoder(unittest.TestCase):
|
|||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder.create(models.GPT4, None, 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))
|
||||
# Mock the send method to set partial_response_content and return False
|
||||
def mock_send(*args, **kwargs):
|
||||
coder.partial_response_content = "a good commit message"
|
||||
return False
|
||||
|
||||
coder.send = MagicMock(side_effect=mock_send)
|
||||
|
||||
# Call the get_commit_message method with dummy diff and context
|
||||
result = coder.get_commit_message("dummy diff", "dummy context")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue