Commit graph

4 commits

Author SHA1 Message Date
Paul Gauthier
ef7e63a728 Add tests for strip_quoted_wrapping function in test_utils.py.
# Context:
USER: add tests for strip_quoted_wrapping
ASSISTANT: I will add tests for the `strip_quoted_wrapping` function in the `test_utils.py` file.

```python
test_utils.py
<<<<<<< ORIGINAL
if __name__ == "__main__":
    unittest.main()
=======
    def test_strip_quoted_wrapping(self):
        input_text = "filename.ext\n```\nWe just want this content\nNot the filename and triple quotes\n```"
        expected_output = "We just want this content\nNot the filename and triple quotes\n"
        result = strip_quoted_wrapping(input_text, "filename.ext")
        self.assertEqual(result, expected_output)

    def test_strip_quoted_wrapping_no_filename(self):
        input_text = "```\nWe just want this content\nNot the triple quotes\n```"
        expected_output = "We just want this content\nNot the triple quotes\n"
        result = strip_quoted_wrapping(input_text)
        self.assertEqual(result, expected_output)

    def test_strip_quoted_wrapping_no_wrapping(self):
        input_text = "We just want this content\nNot the triple quotes\n"
        expected_output = "We just want this content\nNot the triple quotes\n"
        result = strip_quoted_wrapping(input_text)
        self.assertEqual(result, expected_output)

if __name__ == "__main__":
    unittest.main()
>>>>>>> UPDATED
```

These tests cover cases when the input text has a filename, no filename, and no wrapping at all.
2023-05-09 08:44:35 -07:00
Paul Gauthier
8a8bc3e244 Refactor replace_most_similar_chunk function and update test cases. 2023-05-09 07:39:37 -07:00
Paul Gauthier
17589d5241 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`.
2023-05-09 07:36:07 -07:00
Paul Gauthier
350ba4574f Initial commit: Added new files to the git repo: test_utils.py 2023-05-09 07:35:01 -07:00