mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 21:04:59 +00:00
moved into subdir
This commit is contained in:
parent
a6b9023079
commit
984e2f78ce
7 changed files with 0 additions and 0 deletions
42
aider/test_utils.py
Normal file
42
aider/test_utils.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
import unittest
|
||||
from utils import replace_most_similar_chunk
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
def test_replace_most_similar_chunk(self):
|
||||
whole = "This is a sample text.\nAnother line of text.\nYet another line."
|
||||
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."
|
||||
|
||||
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 = "This was a sample text.\nAnother line of txt"
|
||||
replace = "This is a replaced text.\nModified line of text."
|
||||
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)
|
||||
|
||||
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()
|
Loading…
Add table
Add a link
Reference in a new issue