diff --git a/tests/scrape/test_scrape.py b/tests/scrape/test_scrape.py index 5d07b8f1c..af41c0a8e 100644 --- a/tests/scrape/test_scrape.py +++ b/tests/scrape/test_scrape.py @@ -1,5 +1,5 @@ import unittest -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock import re from aider.commands import Commands @@ -12,19 +12,13 @@ class TestScrape(unittest.TestCase): self.io = InputOutput(yes=True) self.commands = Commands(self.io, None) - @patch("aider.scrape.Scraper.scrape") - def test_cmd_web_imports_playwright(self, mock_scrape): - # Mock the scrape method - mock_scrape.return_value = "Mocked webpage content" - + def test_cmd_web_imports_playwright(self): # Run the cmd_web command result = self.commands.cmd_web("https://example.com") - # Assert that the scrape method was called with the correct URL - mock_scrape.assert_called_once_with("https://example.com") - - # Assert that the result contains the mocked content - self.assertIn("Mocked webpage content", result) + # Assert that the result contains some content + self.assertIsNotNone(result) + self.assertNotEqual(result, "") # Try to import playwright try: @@ -39,15 +33,7 @@ class TestScrape(unittest.TestCase): playwright_imported, "Playwright should be importable after running cmd_web" ) - @patch("aider.scrape.sync_playwright") - def test_scrape_actual_url_with_playwright(self, mock_sync_playwright): - # Mock the Playwright browser and page - mock_browser = MagicMock() - mock_page = MagicMock() - mock_browser.new_page.return_value = mock_page - mock_page.content.return_value = "