mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
Fix tests for check_for_urls
This commit is contained in:
parent
3e1ad07069
commit
8a9184cef9
2 changed files with 11 additions and 7 deletions
|
@ -664,7 +664,7 @@ class Coder:
|
|||
return self.commands.run(inp)
|
||||
|
||||
self.check_for_file_mentions(inp)
|
||||
inp = self.check_for_urls(inp)
|
||||
self.check_for_urls(inp)
|
||||
|
||||
return inp
|
||||
|
||||
|
@ -676,7 +676,7 @@ class Coder:
|
|||
inp += "\n\n"
|
||||
inp += self.commands.cmd_web(url)
|
||||
|
||||
return inp
|
||||
return urls
|
||||
|
||||
def keyboard_interrupt(self):
|
||||
now = time.time()
|
||||
|
@ -1227,12 +1227,13 @@ class Coder:
|
|||
sys.stdout.write(text)
|
||||
except UnicodeEncodeError:
|
||||
# Safely encode and decode the text
|
||||
safe_text = text.encode(sys.stdout.encoding, errors='backslashreplace').decode(sys.stdout.encoding)
|
||||
safe_text = text.encode(sys.stdout.encoding, errors="backslashreplace").decode(
|
||||
sys.stdout.encoding
|
||||
)
|
||||
sys.stdout.write(safe_text)
|
||||
sys.stdout.flush()
|
||||
yield text
|
||||
|
||||
|
||||
def live_incremental_response(self, final):
|
||||
show_resp = self.render_incremental_response(final)
|
||||
self.mdstream.update(show_resp, final=final)
|
||||
|
|
|
@ -668,7 +668,7 @@ two
|
|||
issue_cases = [
|
||||
("check http://localhost:3002, there is an error", "http://localhost:3002"),
|
||||
(
|
||||
"can you check out https://example.com/setup#whatever?",
|
||||
"can you check out https://example.com/setup#whatever",
|
||||
"https://example.com/setup#whatever",
|
||||
),
|
||||
]
|
||||
|
@ -687,10 +687,13 @@ two
|
|||
# Test case with no URL
|
||||
no_url_input = "This text contains no URL"
|
||||
result = coder.check_for_urls(no_url_input)
|
||||
self.assertEqual(result, no_url_input)
|
||||
self.assertEqual(result, [])
|
||||
|
||||
# Test case with the same URL appearing multiple times
|
||||
repeated_url_input = "Check https://example.com, then https://example.com again, and https://example.com one more time"
|
||||
repeated_url_input = (
|
||||
"Check https://example.com, then https://example.com again, and https://example.com one"
|
||||
" more time"
|
||||
)
|
||||
result = coder.check_for_urls(repeated_url_input)
|
||||
self.assertEqual(result.count("https://example.com"), 1)
|
||||
self.assertIn("https://example.com", result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue