diff --git a/aider/tests/test_coder.py b/aider/tests/test_coder.py index fcab12aa8..84c483836 100644 --- a/aider/tests/test_coder.py +++ b/aider/tests/test_coder.py @@ -592,19 +592,33 @@ two def test_check_for_urls(self): io = InputOutput(yes=True) coder = Coder.create(self.GPT35, None, io=io, pretty=False) + coder.commands.scraper = MagicMock() + coder.commands.scraper.scrape = MagicMock(return_value="some content") # Test various URL formats test_cases = [ ("Check http://example.com, it's cool", "http://example.com"), ("Visit https://www.example.com/page and see stuff", "https://www.example.com/page"), - ("Go to http://subdomain.example.com:8080/path?query=value, or not", "http://subdomain.example.com:8080/path?query=value"), - ("See https://example.com/path#fragment for example", "https://example.com/path#fragment"), + ( + "Go to http://subdomain.example.com:8080/path?query=value, or not", + "http://subdomain.example.com:8080/path?query=value", + ), + ( + "See https://example.com/path#fragment for example", + "https://example.com/path#fragment", + ), ("Look at http://localhost:3000", "http://localhost:3000"), ("View https://example.com/setup#whatever", "https://example.com/setup#whatever"), ("Open http://127.0.0.1:8000/api/v1/", "http://127.0.0.1:8000/api/v1/"), - ("Try https://example.com/path/to/page.html?param1=value1¶m2=value2", "https://example.com/path/to/page.html?param1=value1¶m2=value2"), + ( + "Try https://example.com/path/to/page.html?param1=value1¶m2=value2", + "https://example.com/path/to/page.html?param1=value1¶m2=value2", + ), ("Access http://user:password@example.com", "http://user:password@example.com"), - ("Use https://example.com/path_(with_parentheses)", "https://example.com/path_(with_parentheses)"), + ( + "Use https://example.com/path_(with_parentheses)", + "https://example.com/path_(with_parentheses)", + ), ] for input_text, expected_url in test_cases: @@ -615,7 +629,10 @@ two # Test cases from the GitHub issue issue_cases = [ ("check http://localhost:3002, there is an error", "http://localhost:3002"), - ("can you check out https://example.com/setup#whatever?", "https://example.com/setup#whatever"), + ( + "can you check out https://example.com/setup#whatever?", + "https://example.com/setup#whatever", + ), ] for input_text, expected_url in issue_cases: @@ -634,5 +651,6 @@ two result = coder.check_for_urls(no_url_input) self.assertEqual(result, no_url_input) + if __name__ == "__main__": unittest.main()