MCPcopy
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / test_lazy_load_empty_content

Function test_lazy_load_empty_content

tests/test_chromium.py:1085–1101  ·  view source on GitHub ↗

Test that lazy_load yields a Document with empty content if the scraper returns an empty string.

(monkeypatch)

Source from the content-addressed store, hash-verified

1083
1084
1085def test_lazy_load_empty_content(monkeypatch):
1086 """Test that lazy_load yields a Document with empty content if the scraper returns an empty string."""
1087 from langchain_core.documents import Document
1088
1089 urls = ["http://example.com"]
1090 loader = ChromiumLoader(urls, backend="playwright", requires_js_support=False)
1091
1092 async def dummy_scraper(url):
1093 return ""
1094
1095 monkeypatch.setattr(loader, "ascrape_playwright", dummy_scraper)
1096 docs = list(loader.lazy_load())
1097 assert len(docs) == 1
1098 for doc in docs:
1099 assert isinstance(doc, Document)
1100 assert doc.page_content == ""
1101 assert doc.metadata["source"] in urls
1102
1103
1104@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

lazy_loadMethod · 0.95
ChromiumLoaderClass · 0.90

Tested by

no test coverage detected