MCPcopy
hub / github.com/scrapy/scrapy / test_parse_sitemap_empty_body

Method test_parse_sitemap_empty_body

tests/test_spider_sitemap.py:258–273  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

256 assert urls == result
257
258 def test_parse_sitemap_empty_body(self):
259 r = XmlResponse(url="http://www.example.com/sitemap.xml", body=b"")
260 spider = self.spider_class("example.com")
261
262 with LogCapture() as lc:
263 results = list(spider._parse_sitemap(r))
264
265 assert not results
266
267 lc.check(
268 (
269 "scrapy.spiders.sitemap",
270 "WARNING",
271 "Ignoring invalid sitemap: <200 http://www.example.com/sitemap.xml>",
272 )
273 )
274
275 def test_parse_sitemap_not_sitemap(self):
276 body = b"""<?xml version="1.0" encoding="UTF-8"?>

Callers

nothing calls this directly

Calls 3

XmlResponseClass · 0.90
_parse_sitemapMethod · 0.80
checkMethod · 0.80

Tested by

no test coverage detected