mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Parametrized test
This commit is contained in:
parent
beb7b4d0f6
commit
ed016f8f5a
|
@ -84,23 +84,24 @@ class TestFileTiff:
|
||||||
with Image.open("Tests/images/multipage.tiff") as im:
|
with Image.open("Tests/images/multipage.tiff") as im:
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
def test_get_child_images(self):
|
@pytest.mark.parametrize(
|
||||||
def check(ims, sizes):
|
"path, sizes",
|
||||||
assert len(ims) == len(sizes)
|
(
|
||||||
|
("Tests/images/hopper.tif", ()),
|
||||||
|
("Tests/images/child_ifd.tiff", (16, 8)),
|
||||||
|
("Tests/images/child_ifd_jpeg.tiff", (20,)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
def test_get_child_images(self, path, sizes):
|
||||||
|
with Image.open(path) as im:
|
||||||
|
ims = im.get_child_images()
|
||||||
|
|
||||||
|
assert len(ims) == len(sizes)
|
||||||
for i, im in enumerate(ims):
|
for i, im in enumerate(ims):
|
||||||
w = sizes[i]
|
w = sizes[i]
|
||||||
expected = Image.new("RGB", (w, w), "#f00")
|
expected = Image.new("RGB", (w, w), "#f00")
|
||||||
assert_image_similar(im, expected, 1)
|
assert_image_similar(im, expected, 1)
|
||||||
|
|
||||||
with Image.open("Tests/images/child_ifd.tiff") as im:
|
|
||||||
ims = im.get_child_images()
|
|
||||||
check(ims, (16, 8))
|
|
||||||
|
|
||||||
with Image.open("Tests/images/child_ifd_jpeg.tiff") as im:
|
|
||||||
ims = im.get_child_images()
|
|
||||||
check(ims, (20,))
|
|
||||||
|
|
||||||
def test_mac_tiff(self):
|
def test_mac_tiff(self):
|
||||||
# Read RGBa images from macOS [@PIL136]
|
# Read RGBa images from macOS [@PIL136]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user