diff --git a/test_utils.py b/test_utils.py index 66b0facdf..2a6167d4c 100644 --- a/test_utils.py +++ b/test_utils.py @@ -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() \ No newline at end of file