mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 22:04:59 +00:00
finished scrape tests
This commit is contained in:
parent
d5a258356b
commit
96b1e1d04f
2 changed files with 7 additions and 6 deletions
|
@ -5,5 +5,6 @@ testpaths =
|
||||||
tests/basic
|
tests/basic
|
||||||
tests/help
|
tests/help
|
||||||
tests/browser
|
tests/browser
|
||||||
|
tests/scrape
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch, MagicMock
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
|
@ -7,10 +7,10 @@ from aider.io import InputOutput
|
||||||
|
|
||||||
class TestScrape(unittest.TestCase):
|
class TestScrape(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.io = InputOutput()
|
self.io = InputOutput(yes=True)
|
||||||
self.commands = Commands(self.io, None)
|
self.commands = Commands(self.io, None)
|
||||||
|
|
||||||
@patch('aider.scraper.Scraper.scrape')
|
@patch("aider.scrape.Scraper.scrape")
|
||||||
def test_cmd_web_imports_playwright(self, mock_scrape):
|
def test_cmd_web_imports_playwright(self, mock_scrape):
|
||||||
# Mock the scrape method
|
# Mock the scrape method
|
||||||
mock_scrape.return_value = "Mocked webpage content"
|
mock_scrape.return_value = "Mocked webpage content"
|
||||||
|
@ -26,15 +26,15 @@ class TestScrape(unittest.TestCase):
|
||||||
|
|
||||||
# Try to import playwright
|
# Try to import playwright
|
||||||
try:
|
try:
|
||||||
import playwright
|
import playwright # noqa: F401
|
||||||
|
|
||||||
playwright_imported = True
|
playwright_imported = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
playwright_imported = False
|
playwright_imported = False
|
||||||
|
|
||||||
# Assert that playwright was successfully imported
|
# Assert that playwright was successfully imported
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
playwright_imported,
|
playwright_imported, "Playwright should be importable after running cmd_web"
|
||||||
"Playwright should be importable after running cmd_web"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue