MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_gzipped_sitemap

Function test_gzipped_sitemap

tests/unit/_utils/test_sitemap.py:132–138  ·  view source on GitHub ↗

Test loading a gzipped sitemap with correct type and .xml.gz url.

(server_url: URL, http_client: HttpClient)

Source from the content-addressed store, hash-verified

130
131
132async def test_gzipped_sitemap(server_url: URL, http_client: HttpClient) -> None:
133 """Test loading a gzipped sitemap with correct type and .xml.gz url."""
134 gzipped_data = encode_base64(compress_gzip(get_basic_sitemap(url=server_url)))
135 sitemap_url = (server_url / 'sitemap.xml.gz').with_query(base64=gzipped_data, c_type='application/gzip')
136 sitemap = await Sitemap.load(str(sitemap_url), http_client=http_client)
137 assert len(sitemap.urls) == 5
138 assert set(sitemap.urls) == get_basic_results(server_url)
139
140
141async def test_gzipped_sitemap_with_invalid_data(server_url: URL, http_client: HttpClient) -> None:

Callers

nothing calls this directly

Calls 5

get_basic_sitemapFunction · 0.90
get_basic_resultsFunction · 0.90
encode_base64Function · 0.70
compress_gzipFunction · 0.70
loadMethod · 0.45

Tested by

no test coverage detected