mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 17:54:32 +03:00
flake8
This commit is contained in:
parent
ca7608f1d5
commit
a59bc40c38
|
@ -2,6 +2,7 @@ from tester import *
|
|||
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def test_sanity():
|
||||
|
||||
def convert(im, mode):
|
||||
|
@ -16,6 +17,7 @@ def test_sanity():
|
|||
for mode in modes:
|
||||
yield_test(convert, im, mode)
|
||||
|
||||
|
||||
def test_default():
|
||||
|
||||
im = lena("P")
|
||||
|
@ -26,7 +28,6 @@ def test_default():
|
|||
assert_image(im, "RGB", im.size)
|
||||
|
||||
|
||||
|
||||
# ref https://github.com/python-imaging/Pillow/issues/274
|
||||
|
||||
def _test_float_conversion(im):
|
||||
|
@ -34,18 +35,22 @@ def _test_float_conversion(im):
|
|||
converted = im.convert('F').getpixel((5, 5))
|
||||
assert_equal(orig, converted)
|
||||
|
||||
|
||||
def test_8bit():
|
||||
im = Image.open('Images/lena.jpg')
|
||||
_test_float_conversion(im.convert('L'))
|
||||
|
||||
|
||||
def test_16bit():
|
||||
im = Image.open('Tests/images/16bit.cropped.tif')
|
||||
_test_float_conversion(im)
|
||||
|
||||
|
||||
def test_16bit_workaround():
|
||||
im = Image.open('Tests/images/16bit.cropped.tif')
|
||||
_test_float_conversion(im.convert('I'))
|
||||
|
||||
|
||||
def test_rgba_p():
|
||||
im = lena('RGBA')
|
||||
im.putalpha(lena('L'))
|
||||
|
@ -55,6 +60,7 @@ def test_rgba_p():
|
|||
|
||||
assert_image_similar(im, comparable, 20)
|
||||
|
||||
|
||||
def test_trns_p():
|
||||
im = lena('P')
|
||||
im.info['transparency'] = 0
|
||||
|
@ -65,12 +71,13 @@ def test_trns_p():
|
|||
assert_equal(l.info['transparency'], 0) # undone
|
||||
assert_no_exception(lambda: l.save(f))
|
||||
|
||||
|
||||
rgb = im.convert('RGB')
|
||||
assert_equal(rgb.info['transparency'], (0, 0, 0)) # undone
|
||||
assert_no_exception(lambda: rgb.save(f))
|
||||
|
||||
|
||||
# ref https://github.com/python-imaging/Pillow/issues/664
|
||||
|
||||
def test_trns_p_rgba():
|
||||
# Arrange
|
||||
im = lena('P')
|
||||
|
@ -121,5 +128,3 @@ def test_trns_RGB():
|
|||
lambda: im.convert('P', palette=Image.ADAPTIVE))
|
||||
assert_false('transparency' in p.info)
|
||||
assert_no_exception(lambda: p.save(f))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user