mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
fix wholefile tests
This commit is contained in:
parent
fef5a7b917
commit
3401395e61
2 changed files with 9 additions and 9 deletions
|
@ -801,13 +801,17 @@ class Coder:
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def update_files(self):
|
||||||
|
edits = self.get_edits()
|
||||||
|
edits = self.prepare_to_edit(edits)
|
||||||
|
self.apply_edits(edits)
|
||||||
|
return set(edit[0] for edit in edits)
|
||||||
|
|
||||||
def apply_updates(self):
|
def apply_updates(self):
|
||||||
max_apply_update_errors = 3
|
max_apply_update_errors = 3
|
||||||
|
|
||||||
try:
|
try:
|
||||||
edits = self.get_edits()
|
edited = self.update_files()
|
||||||
edits = self.prepare_to_edit(edits)
|
|
||||||
self.apply_edits(edits)
|
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
err = err.args[0]
|
err = err.args[0]
|
||||||
self.apply_update_errors += 1
|
self.apply_update_errors += 1
|
||||||
|
@ -833,11 +837,7 @@ class Coder:
|
||||||
|
|
||||||
self.apply_update_errors = 0
|
self.apply_update_errors = 0
|
||||||
|
|
||||||
# TODO FIXME: make sure
|
for path in edited:
|
||||||
edited = set()
|
|
||||||
for edit in sorted(edits):
|
|
||||||
path = edit[0]
|
|
||||||
edited.add(path)
|
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
self.io.tool_output(f"Did not apply edit to {path} (--dry-run)")
|
self.io.tool_output(f"Did not apply edit to {path} (--dry-run)")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -90,7 +90,7 @@ class TestWholeFileCoder(unittest.TestCase):
|
||||||
# Set the partial response content with the updated content
|
# Set the partial response content with the updated content
|
||||||
coder.partial_response_content = f"{sample_file}\n```\n0\n\1\n2\n"
|
coder.partial_response_content = f"{sample_file}\n```\n0\n\1\n2\n"
|
||||||
|
|
||||||
lines = coder.update_files(mode="diff").splitlines()
|
lines = coder.get_edits(mode="diff").splitlines()
|
||||||
|
|
||||||
# the live diff should be concise, since we haven't changed anything yet
|
# the live diff should be concise, since we haven't changed anything yet
|
||||||
self.assertLess(len(lines), 20)
|
self.assertLess(len(lines), 20)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue