MCPcopy
hub / github.com/scrapy/scrapy / test_get_transposed_images

Method test_get_transposed_images

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

Source from the content-addressed store, hash-verified

177 assert orig_thumb_buf.getvalue() == thumb_buf.getvalue()
178
179 def test_get_transposed_images(self):
180 orig_im = Image.new("RGB", (2, 2), (0, 0, 0))
181 orig_im.putpixel((1, 1), (255, 0, 0))
182 exif = orig_im.getexif()
183 exif[274] = 3
184 buf = io.BytesIO()
185 orig_im.save(buf, "PNG", exif=exif)
186 buf.seek(0)
187
188 resp = Response(url="https://dev.mydeco.com/mydeco.gif", body=buf.getvalue())
189 req = Request(url="https://dev.mydeco.com/mydeco.gif")
190
191 get_images_gen = self.pipeline.get_images(
192 response=resp, request=req, info=object()
193 )
194
195 path, new_im, _ = next(get_images_gen)
196 assert path == "full/3fd165099d8e71b8a48b2683946e64dbfad8b52d.jpg"
197 assert new_im.getpixel((0, 0)) == (255, 0, 0)
198
199 def test_convert_image(self):
200 SIZE = (100, 100)

Callers

nothing calls this directly

Calls 3

ResponseClass · 0.90
RequestClass · 0.90
get_imagesMethod · 0.80

Tested by

no test coverage detected