This commit is contained in:
dutcu 2024-06-22 17:28:37 +02:00
parent dfea906a80
commit 26848c48a7
2 changed files with 40 additions and 1 deletions

38
Tests/test_new_cms.py Normal file
View File

@ -0,0 +1,38 @@
import pytest
from PIL import ImageCms
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" # This should not be 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 # Assuming this value is outside the valid range
)
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", # This should trigger the error
flags=0
)
assert str(exc_info.value) == "renderingIntent must be an integer between 0 and 3"

View File

@ -20,7 +20,8 @@ def calculate_coverage(test_name):
"branches2": PdfParser.XrefTable.branches, # duru
"branches3": SpiderImagePlugin.branches, # isidora
"branches4": MpegImagePlugin.BitStream.branches, # isidora
"branches6": ImageFile.PyEncoder.branches, # deekshu
"branches5": ImageCms.branches, # deekshu
"branches6": ImageFile.branches, # deekshu
# Add more
}