MCPcopy
hub / github.com/scrapinghub/splash / assertPng

Method assertPng

splash/tests/test_render.py:101–110  ·  view source on GitHub ↗
(self, response, width=None, height=None)

Source from the content-addressed store, hash-verified

99 self.assertEqual(data['info']['argument'], argname)
100
101 def assertPng(self, response, width=None, height=None):
102 self.assertStatusCode(response, 200)
103 self.assertEqual(response.headers["content-type"], "image/png")
104 img = Image.open(BytesIO(response.content))
105 self.assertEqual(img.format, "PNG")
106 if width is not None:
107 self.assertEqual(img.size[0], width)
108 if height is not None:
109 self.assertEqual(img.size[1], height)
110 return img
111
112 def assertJpeg(self, response, width=None, height=None):
113 self.assertStatusCode(response, 200)

Calls 1

assertStatusCodeMethod · 0.95

Tested by

no test coverage detected