diff --git a/Tests/test_new_cms.py b/Tests/test_new_cms.py new file mode 100644 index 000000000..024a30213 --- /dev/null +++ b/Tests/test_new_cms.py @@ -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" + + \ No newline at end of file diff --git a/conftest.py b/conftest.py index 581940539..adf552ed8 100644 --- a/conftest.py +++ b/conftest.py @@ -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 }