mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 22:04:59 +00:00
fix: Update test for scrape method with correct mocking
This commit is contained in:
parent
2cc4ae6e88
commit
6c38766c92
1 changed files with 14 additions and 1 deletions
|
@ -100,7 +100,7 @@ class TestScrape(unittest.TestCase):
|
||||||
|
|
||||||
# Mock the necessary objects and methods
|
# Mock the necessary objects and methods
|
||||||
scraper.scrape_with_playwright = MagicMock()
|
scraper.scrape_with_playwright = MagicMock()
|
||||||
scraper.scrape_with_playwright.return_value = None
|
scraper.scrape_with_playwright.return_value = (None, None)
|
||||||
|
|
||||||
# Call the scrape method
|
# Call the scrape method
|
||||||
result = scraper.scrape("https://example.com")
|
result = scraper.scrape("https://example.com")
|
||||||
|
@ -113,6 +113,19 @@ class TestScrape(unittest.TestCase):
|
||||||
"Failed to retrieve content from https://example.com"
|
"Failed to retrieve content from https://example.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Reset the mock
|
||||||
|
mock_print_error.reset_mock()
|
||||||
|
|
||||||
|
# Test with a different return value
|
||||||
|
scraper.scrape_with_playwright.return_value = ("Some content", "text/html")
|
||||||
|
result = scraper.scrape("https://example.com")
|
||||||
|
|
||||||
|
# Assert that the result is not None
|
||||||
|
self.assertIsNotNone(result)
|
||||||
|
|
||||||
|
# Assert that print_error was not called
|
||||||
|
mock_print_error.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue