improvement of buildTransform function's coverage

This commit is contained in:
Deekshu Kare 2024-06-27 01:34:56 +02:00
parent ef83eaf4c3
commit 52965eed2d

View File

@ -698,3 +698,38 @@ def test_deprecation() -> None:
assert ImageCms.VERSION == "1.0.0 pil"
with pytest.warns(DeprecationWarning):
assert isinstance(ImageCms.FLAGS, dict)
def test_buildTransform_flags_non_integer():
with pytest.raises(ImageCms.PyCMSError):
ImageCms.buildTransform(
inputProfile="path/to/input/profile",
outputProfile="path/to/output/profile",
inMode="RGB",
outMode="CMYK",
renderingIntent=ImageCms.Intent.PERCEPTUAL,
flags="not_an_integer"
)
def test_buildTransform_flags_out_of_range():
with pytest.raises(ImageCms.PyCMSError):
ImageCms.buildTransform(
inputProfile="path/to/input/profile",
outputProfile="path/to/output/profile",
inMode="RGB",
outMode="CMYK",
renderingIntent=ImageCms.Intent.PERCEPTUAL,
flags=999999
)
def test_renderingIntent_non_integer():
with pytest.raises(ImageCms.PyCMSError) as exc_info:
ImageCms.buildTransform(
inputProfile="path/to/input/profile",
outputProfile="path/to/output/profile",
inMode="RGB",
outMode="CMYK",
renderingIntent="not an integer",
flags=0
)
assert str(exc_info.value) == "renderingIntent must be an integer between 0 and 3"