mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-21 01:32:00 +03:00
improvement of buildTransform function's coverage
This commit is contained in:
parent
ef83eaf4c3
commit
52965eed2d
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user