MCPcopy
hub / github.com/Aider-AI/aider / test_scrape_text_html

Method test_scrape_text_html

tests/scrape/test_scrape.py:152–171  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

150 self.assertEqual(result, plain_text)
151
152 def test_scrape_text_html(self):
153 # Create a Scraper instance
154 scraper = Scraper(print_error=MagicMock(), playwright_available=True)
155
156 # Mock the scrape_with_playwright method
157 html_content = "<html><body><h1>Test</h1><p>This is HTML content.</p></body></html>"
158 scraper.scrape_with_playwright = MagicMock(return_value=(html_content, "text/html"))
159
160 # Mock the html_to_markdown method
161 expected_markdown = "# Test\n\nThis is HTML content."
162 scraper.html_to_markdown = MagicMock(return_value=expected_markdown)
163
164 # Call the scrape method
165 result = scraper.scrape("https://example.com")
166
167 # Assert that the result is the expected markdown
168 self.assertEqual(result, expected_markdown)
169
170 # Assert that html_to_markdown was called with the HTML content
171 scraper.html_to_markdown.assert_called_once_with(html_content)
172
173
174if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

scrapeMethod · 0.95
ScraperClass · 0.90

Tested by

no test coverage detected