mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
fix tests and bug
This commit is contained in:
parent
fe4a2836b7
commit
6133eb61c1
2 changed files with 6 additions and 3 deletions
|
@ -44,7 +44,10 @@ def replace_most_similar_chunk(whole, part, replace):
|
|||
+ replace_lines
|
||||
+ whole_lines[most_similar_chunk_end:]
|
||||
)
|
||||
modified_whole = "\n".join(modified_whole) + "\n"
|
||||
modified_whole = "\n".join(modified_whole)
|
||||
|
||||
if whole.endswith("\n"):
|
||||
modified_whole += "\n"
|
||||
|
||||
return modified_whole
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ from aider.utils import replace_most_similar_chunk, strip_quoted_wrapping
|
|||
|
||||
class TestUtils(unittest.TestCase):
|
||||
def test_replace_most_similar_chunk(self):
|
||||
whole = "This is a sample text.\nAnother line of text.\nYet another line."
|
||||
whole = "This is a sample text.\nAnother line of text.\nYet another line.\n"
|
||||
part = "This is a sample text"
|
||||
replace = "This is a replaced text."
|
||||
expected_output = "This is a replaced text.\nAnother line of text.\nYet another line."
|
||||
expected_output = "This is a replaced text..\nAnother line of text.\nYet another line.\n"
|
||||
|
||||
result = replace_most_similar_chunk(whole, part, replace)
|
||||
self.assertEqual(result, expected_output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue