mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 21:04:59 +00:00
Fixed quote stripping of gpt3.5 commit messages
This commit is contained in:
parent
3d8ecddb3f
commit
bd78789bd2
2 changed files with 36 additions and 1 deletions
|
@ -76,5 +76,38 @@ class TestCoder(unittest.TestCase):
|
|||
# Assert that the returned message is the expected one
|
||||
self.assertEqual(result, "a good commit message")
|
||||
|
||||
def test_get_commit_message_strip_quotes(self):
|
||||
# Mock the IO object
|
||||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(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))
|
||||
|
||||
# Call the get_commit_message method with dummy diff and context
|
||||
result = coder.get_commit_message("dummy diff", "dummy context")
|
||||
|
||||
# Assert that the returned message is the expected one
|
||||
self.assertEqual(result, "a good commit message")
|
||||
|
||||
def test_get_commit_message_no_strip_unmatched_quotes(self):
|
||||
# Mock the IO object
|
||||
mock_io = MagicMock()
|
||||
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder(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))
|
||||
|
||||
# Call the get_commit_message method with dummy diff and context
|
||||
result = coder.get_commit_message("dummy diff", "dummy context")
|
||||
|
||||
# Assert that the returned message is the expected one
|
||||
self.assertEqual(result, 'a good "commit message"')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue