mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Parametrize test
This commit is contained in:
parent
28f436c94d
commit
533f78e0a2
|
@ -735,24 +735,31 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
assert icc_libtiff is not None
|
assert icc_libtiff is not None
|
||||||
assert icc == icc_libtiff
|
assert icc == icc_libtiff
|
||||||
|
|
||||||
def test_write_icc(self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
@pytest.mark.parametrize(
|
||||||
def check_write(libtiff: bool) -> None:
|
"libtiff",
|
||||||
monkeypatch.setattr(TiffImagePlugin, "WRITE_LIBTIFF", libtiff)
|
(
|
||||||
|
pytest.param(
|
||||||
|
True,
|
||||||
|
marks=pytest.mark.skipif(
|
||||||
|
not Image.core.libtiff_support_custom_tags,
|
||||||
|
reason="Custom tags not supported by older libtiff",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
def test_write_icc(
|
||||||
|
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path, libtiff: bool
|
||||||
|
) -> None:
|
||||||
|
monkeypatch.setattr(TiffImagePlugin, "WRITE_LIBTIFF", libtiff)
|
||||||
|
|
||||||
with Image.open("Tests/images/hopper.iccprofile.tif") as img:
|
with Image.open("Tests/images/hopper.iccprofile.tif") as img:
|
||||||
icc_profile = img.info["icc_profile"]
|
icc_profile = img.info["icc_profile"]
|
||||||
|
|
||||||
out = str(tmp_path / "temp.tif")
|
out = str(tmp_path / "temp.tif")
|
||||||
img.save(out, icc_profile=icc_profile)
|
img.save(out, icc_profile=icc_profile)
|
||||||
with Image.open(out) as reloaded:
|
with Image.open(out) as reloaded:
|
||||||
assert icc_profile == reloaded.info["icc_profile"]
|
assert icc_profile == reloaded.info["icc_profile"]
|
||||||
|
|
||||||
libtiffs = [False]
|
|
||||||
if Image.core.libtiff_support_custom_tags:
|
|
||||||
libtiffs.append(True)
|
|
||||||
|
|
||||||
for libtiff in libtiffs:
|
|
||||||
check_write(libtiff)
|
|
||||||
|
|
||||||
def test_multipage_compression(self) -> None:
|
def test_multipage_compression(self) -> None:
|
||||||
with Image.open("Tests/images/compression.tif") as im:
|
with Image.open("Tests/images/compression.tif") as im:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user