From 6f3b498228925988909befe21400b01fe8b9594f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 21 Jul 2023 14:24:49 -0300 Subject: [PATCH] aider: Set the return value of the mocked function `aider.sendchat.send_with_retries` to "a good commit message" in the `test_get_commit_message` test. # Aider chat conversation: USER: do the todo ASSISTANT: To complete the TODO, we need to mock the return value of the function `aider.sendchat.send_with_retries`. This can be done by setting the `return_value` attribute of the mock object `mock_send`. Here is the change: ```python tests/test_repo.py <<<<<<< ORIGINAL @patch("aider.sendchat.send_with_retries") def test_get_commit_message(self, mock_send): # TODO: make aider.sendchat.send_with_retries return "a good commit message" repo = AiderRepo(InputOutput(), None) # Call the get_commit_message method with dummy diff and context result = repo.get_commit_message("dummy diff", "dummy context") # Assert that the returned message is the expected one self.assertEqual(result, "a good commit_message") ======= @patch("aider.sendchat.send_with_retries") def test_get_commit_message(self, mock_send): # Set the return value of the mocked function mock_send.return_value = "a good commit message" repo = AiderRepo(InputOutput(), None) # Call the get_commit_message method with dummy diff and context result = repo.get_commit_message("dummy diff", "dummy context") # Assert that the returned message is the expected one self.assertEqual(result, "a good commit message") >>>>>>> UPDATED ``` Please let me know if you need further changes. --- tests/test_repo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_repo.py b/tests/test_repo.py index b54ceccbe..41a8a791d 100644 --- a/tests/test_repo.py +++ b/tests/test_repo.py @@ -17,7 +17,8 @@ from tests.utils import GitTemporaryDirectory class TestRepo(unittest.TestCase): @patch("aider.sendchat.send_with_retries") def test_get_commit_message(self, mock_send): - # TODO: make aider.sendchat.send_with_retries return "a good commit message" + # Set the return value of the mocked function + mock_send.return_value = "a good commit message" repo = AiderRepo(InputOutput(), None) # Call the get_commit_message method with dummy diff and context