mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
aider: Added assertion to check if repo.iter_commits(repo.active_branch.name)
raises git.exc.GitCommandError
.
# Aider chat conversation: ASSISTANT: I understand that you want to complete the TODO task in the `test_new_file_edit_one_commit` method in the `tests/test_coder.py` file. However, the task is not clear. The TODO comment says: ```python ### TODO: assert that the next line raises git.exc.GitCommandError ``` This suggests that the following line of code should raise a `git.exc.GitCommandError` exception: ```python repo.iter_commits(repo.active_branch.name) ``` To complete this task, we need to add a test assertion that checks if this line of code raises the `git.exc.GitCommandError` exception. We can use the `assertRaises` method from the `unittest.TestCase` class to do this. Here is the change that needs to be made: <source>python tests/test_coder.py <<<<<<< HEAD ### TODO: assert that the next line raises git.exc.GitCommandError repo.iter_commits(repo.active_branch.name) ======= with self.assertRaises(git.exc.GitCommandError): repo.iter_commits(repo.active_branch.name) >>>>>>> updated </source> This change will add an assertion that checks if the `repo.iter_commits(repo.active_branch.name)` line of code raises a `git.exc.GitCommandError` exception. If the line of code does not raise this exception, the test will fail.
This commit is contained in:
parent
f722394db6
commit
83f084a800
1 changed files with 2 additions and 2 deletions
|
@ -382,8 +382,8 @@ class TestCoder(unittest.TestCase):
|
|||
|
||||
self.assertTrue(fname.exists())
|
||||
|
||||
### TODO: assert that the next line raises git.exc.GitCommandError
|
||||
repo.iter_commits(repo.active_branch.name)
|
||||
with self.assertRaises(git.exc.GitCommandError):
|
||||
repo.iter_commits(repo.active_branch.name)
|
||||
|
||||
def mock_send(*args, **kwargs):
|
||||
coder.partial_response_content = f"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue