fix tests and bug

This commit is contained in:
Paul Gauthier 2023-05-11 17:15:19 -07:00
parent fe4a2836b7
commit 6133eb61c1
2 changed files with 6 additions and 3 deletions

View file

@ -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

View file

@ -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)