mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
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.
This commit is contained in:
parent
941b1e50eb
commit
ef7e63a728
1 changed files with 19 additions and 1 deletions
|
@ -20,5 +20,23 @@ class TestUtils(unittest.TestCase):
|
||||||
result = replace_most_similar_chunk(whole, part, replace)
|
result = replace_most_similar_chunk(whole, part, replace)
|
||||||
self.assertEqual(result, expected_output)
|
self.assertEqual(result, expected_output)
|
||||||
|
|
||||||
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue