mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
aider: Mocked get_commit_message
to return "I added str(fname)".
# Aider chat conversation: USER: mock `get_commit_message` to return "I added str(fname)" ASSISTANT: To mock the `get_commit_message` method to return "I added str(fname)", we need to modify the `test_new_file_commit_message` function in the `tests/test_coder.py` file. Here is the change needed: <source>python tests/test_coder.py <<<<<<< ORIGINAL # Get the latest commit message commit_message = repo.head.commit.message # Check that the latest commit message contains the filename self.assertIn(str(fname), commit_message) ======= # Mock the get_commit_message method to return "I added str(fname)" repo.get_commit_message = MagicMock(return_value=f"I added {str(fname)}") # Get the latest commit message commit_message = repo.get_commit_message() # Check that the latest commit message is "I added str(fname)" self.assertEqual(commit_message, f"I added {str(fname)}") >>>>>>> UPDATED </source>
This commit is contained in:
parent
737c2e0b5f
commit
20c7eb549c
1 changed files with 5 additions and 3 deletions
|
@ -33,10 +33,12 @@ class TestCoder(unittest.TestCase):
|
|||
|
||||
self.assertTrue(fname.exists())
|
||||
|
||||
# Mock the get_commit_message method to return "I added str(fname)"
|
||||
repo.get_commit_message = MagicMock(return_value=f"I added {str(fname)}")
|
||||
# Get the latest commit message
|
||||
commit_message = repo.head.commit.message
|
||||
# Check that the latest commit message contains the filename
|
||||
self.assertIn(str(fname), commit_message)
|
||||
commit_message = repo.get_commit_message()
|
||||
# Check that the latest commit message is "I added str(fname)"
|
||||
self.assertEqual(commit_message, f"I added {str(fname)}")
|
||||
|
||||
|
||||
def test_allowed_to_edit(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue