MCPcopy
hub / github.com/scrapy/scrapy / test_get_images_exception

Method test_get_images_exception

tests/test_pipeline_images.py:136–154  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

134 )
135
136 def test_get_images_exception(self):
137 self.pipeline.min_width = 100
138 self.pipeline.min_height = 100
139
140 _, buf1 = _create_image("JPEG", "RGB", (50, 50), (0, 0, 0))
141 _, buf2 = _create_image("JPEG", "RGB", (150, 50), (0, 0, 0))
142 _, buf3 = _create_image("JPEG", "RGB", (50, 150), (0, 0, 0))
143
144 resp1 = Response(url="https://dev.mydeco.com/mydeco.gif", body=buf1.getvalue())
145 resp2 = Response(url="https://dev.mydeco.com/mydeco.gif", body=buf2.getvalue())
146 resp3 = Response(url="https://dev.mydeco.com/mydeco.gif", body=buf3.getvalue())
147 req = Request(url="https://dev.mydeco.com/mydeco.gif")
148
149 with pytest.raises(ImageException):
150 next(self.pipeline.get_images(response=resp1, request=req, info=object()))
151 with pytest.raises(ImageException):
152 next(self.pipeline.get_images(response=resp2, request=req, info=object()))
153 with pytest.raises(ImageException):
154 next(self.pipeline.get_images(response=resp3, request=req, info=object()))
155
156 def test_get_images(self):
157 self.pipeline.min_width = 0

Callers

nothing calls this directly

Calls 4

ResponseClass · 0.90
RequestClass · 0.90
_create_imageFunction · 0.85
get_imagesMethod · 0.80

Tested by

no test coverage detected