mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
aider: Check that the latest commit message contains the filename.
# Aider chat conversation: USER: do the todo ASSISTANT: To complete the TODO task in the `test_new_file_commit_message` function, we need to check that the latest commit message contains the filename. We can do this by getting the latest commit message from the git repository and checking if the filename is in it. Here is the change needed in the `tests/test_coder.py` file: <source>python tests/test_coder.py <<<<<<< ORIGINAL # TODO: check that the latest commit message contains 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) >>>>>>> UPDATED </source>
This commit is contained in:
parent
3698b12215
commit
737c2e0b5f
1 changed files with 17 additions and 0 deletions
|
@ -22,6 +22,23 @@ class TestCoder(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
self.patcher.stop()
|
||||
|
||||
def test_new_file_commit_message(self):
|
||||
with GitTemporaryDirectory():
|
||||
repo = git.Repo()
|
||||
fname = Path("foo.txt")
|
||||
|
||||
io = InputOutput(yes=True)
|
||||
# Initialize the Coder object with the mocked IO and mocked repo
|
||||
coder = Coder.create(models.GPT4, None, io, fnames=[str(fname)])
|
||||
|
||||
self.assertTrue(fname.exists())
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
def test_allowed_to_edit(self):
|
||||
with GitTemporaryDirectory():
|
||||
repo = git.Repo(Path.cwd())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue