mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
flake8
This commit is contained in:
parent
d866a29bd8
commit
a428321bee
|
@ -60,7 +60,8 @@ class TestFileJpeg(PillowTestCase):
|
||||||
self.assertGreater(y, 0.8)
|
self.assertGreater(y, 0.8)
|
||||||
self.assertEqual(k, 0.0)
|
self.assertEqual(k, 0.0)
|
||||||
# the opposite corner is black
|
# the opposite corner is black
|
||||||
c, m, y, k = [x / 255.0 for x in im.getpixel((im.size[0]-1, im.size[1]-1))]
|
c, m, y, k = [x / 255.0 for x in im.getpixel((
|
||||||
|
im.size[0]-1, im.size[1]-1))]
|
||||||
self.assertGreater(k, 0.9)
|
self.assertGreater(k, 0.9)
|
||||||
# roundtrip, and check again
|
# roundtrip, and check again
|
||||||
im = self.roundtrip(im)
|
im = self.roundtrip(im)
|
||||||
|
@ -69,7 +70,8 @@ class TestFileJpeg(PillowTestCase):
|
||||||
self.assertGreater(m, 0.8)
|
self.assertGreater(m, 0.8)
|
||||||
self.assertGreater(y, 0.8)
|
self.assertGreater(y, 0.8)
|
||||||
self.assertEqual(k, 0.0)
|
self.assertEqual(k, 0.0)
|
||||||
c, m, y, k = [x / 255.0 for x in im.getpixel((im.size[0]-1, im.size[1]-1))]
|
c, m, y, k = [x / 255.0 for x in im.getpixel((
|
||||||
|
im.size[0]-1, im.size[1]-1))]
|
||||||
self.assertGreater(k, 0.9)
|
self.assertGreater(k, 0.9)
|
||||||
|
|
||||||
def test_dpi(self):
|
def test_dpi(self):
|
||||||
|
@ -150,7 +152,8 @@ class TestFileJpeg(PillowTestCase):
|
||||||
if py3:
|
if py3:
|
||||||
a = bytes(random.randint(0, 255) for _ in range(256 * 256 * 3))
|
a = bytes(random.randint(0, 255) for _ in range(256 * 256 * 3))
|
||||||
else:
|
else:
|
||||||
a = b''.join(chr(random.randint(0, 255)) for _ in range(256 * 256 * 3))
|
a = b''.join(chr(random.randint(0, 255)) for _ in range(
|
||||||
|
256 * 256 * 3))
|
||||||
im = Image.frombuffer("RGB", (256, 256), a, "raw", "RGB", 0, 1)
|
im = Image.frombuffer("RGB", (256, 256), a, "raw", "RGB", 0, 1)
|
||||||
# this requires more bytes than pixels in the image
|
# this requires more bytes than pixels in the image
|
||||||
im.save(f, format="JPEG", progressive=True, quality=100)
|
im.save(f, format="JPEG", progressive=True, quality=100)
|
||||||
|
@ -235,8 +238,10 @@ class TestFileJpeg(PillowTestCase):
|
||||||
qtables = im.quantization
|
qtables = im.quantization
|
||||||
reloaded = self.roundtrip(im, qtables=qtables, subsampling=0)
|
reloaded = self.roundtrip(im, qtables=qtables, subsampling=0)
|
||||||
self.assertEqual(im.quantization, reloaded.quantization)
|
self.assertEqual(im.quantization, reloaded.quantization)
|
||||||
self.assert_image_similar(im, self.roundtrip(im, qtables='web_low'), 30)
|
self.assert_image_similar(im, self.roundtrip(im, qtables='web_low'),
|
||||||
self.assert_image_similar(im, self.roundtrip(im, qtables='web_high'), 30)
|
30)
|
||||||
|
self.assert_image_similar(im, self.roundtrip(im, qtables='web_high'),
|
||||||
|
30)
|
||||||
self.assert_image_similar(im, self.roundtrip(im, qtables='keep'), 30)
|
self.assert_image_similar(im, self.roundtrip(im, qtables='keep'), 30)
|
||||||
|
|
||||||
# values from wizard.txt in jpeg9-a src package.
|
# values from wizard.txt in jpeg9-a src package.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user