mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
Add test case for replace_most_similar_chunk
with multi-line non-perfect match.
# Context: USER: add another test case for replace_most_similar_chunk where it's not a perfect match, and part has more than 1 line ASSISTANT: I will add a new test case to `test_utils.py` where the `part` has more than 1 line and it's not a perfect match. ```python test_utils.py <<<<<<< ORIGINAL if __name__ == "__main__": unittest.main() ======= def test_replace_most_similar_chunk_not_perfect_match(self): whole = "This is a sample text.\nAnother line of text.\nYet another line." part = "sample text.\nAnother line" replace = "replaced text.\nModified line" expected_output = "This is a replaced text.\nModified line of text.\nYet another line." result = replace_most_similar_chunk(whole, part, replace) self.assertEqual(result, expected_output) if __name__ == "__main__": unittest.main() >>>>>>> UPDATED ``` This new test case checks if the `replace_most_similar_chunk` function can handle a non-perfect match with a multi-line `part`.
This commit is contained in:
parent
350ba4574f
commit
17589d5241
1 changed files with 10 additions and 1 deletions
|
@ -11,5 +11,14 @@ class TestUtils(unittest.TestCase):
|
|||
result = replace_most_similar_chunk(whole, part, replace)
|
||||
self.assertEqual(result, expected_output)
|
||||
|
||||
def test_replace_most_similar_chunk_not_perfect_match(self):
|
||||
whole = "This is a sample text.\nAnother line of text.\nYet another line."
|
||||
part = "sample text.\nAnother line"
|
||||
replace = "replaced text.\nModified line"
|
||||
expected_output = "This is a replaced text.\nModified line of text.\nYet another line."
|
||||
|
||||
result = replace_most_similar_chunk(whole, part, replace)
|
||||
self.assertEqual(result, expected_output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue