MCPcopy
hub / github.com/scrapy/scrapy / test_get_media_requests

Method test_get_media_requests

tests/test_pipeline_media.py:287–302  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

285
286 @coroutine_test
287 async def test_get_media_requests(self):
288 # returns single Request (without callback)
289 req = Request("http://url")
290 item = {"requests": req} # pass a single item
291 new_item = await self.pipe.process_item(item)
292 assert new_item is item
293 assert self.fingerprint(req) in self.info.downloaded
294
295 # returns iterable of Requests
296 req1 = Request("http://url1")
297 req2 = Request("http://url2")
298 item = {"requests": iter([req1, req2])}
299 new_item = await self.pipe.process_item(item)
300 assert new_item is item
301 assert self.fingerprint(req1) in self.info.downloaded
302 assert self.fingerprint(req2) in self.info.downloaded
303
304 @coroutine_test
305 async def test_results_are_cached_across_multiple_items(self):

Callers

nothing calls this directly

Calls 3

RequestClass · 0.90
process_itemMethod · 0.45
fingerprintMethod · 0.45

Tested by

no test coverage detected