langchain/tests/integration_tests/document_loaders/test_sitemap.py
Harrison Chase a0cd6672aa
Harrison/site map (#2061)
Co-authored-by: Tim Asp <707699+timothyasp@users.noreply.github.com>
2023-03-27 16:28:08 -07:00

21 lines
639 B
Python

from langchain.document_loaders import SitemapLoader
def test_sitemap() -> None:
"""Test sitemap loader."""
loader = SitemapLoader("https://langchain.readthedocs.io/sitemap.xml")
documents = loader.load()
assert len(documents) > 1
assert "🦜🔗" in documents[0].page_content
def test_filter_sitemap() -> None:
"""Test sitemap loader."""
loader = SitemapLoader(
"https://langchain.readthedocs.io/sitemap.xml",
filter_urls=["https://langchain.readthedocs.io/en/stable/"],
)
documents = loader.load()
assert len(documents) == 1
assert "🦜🔗" in documents[0].page_content