mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Check other exception messages
This commit is contained in:
parent
6c889d1088
commit
983a6139d5
|
@ -174,19 +174,25 @@ def test_exceptions():
|
|||
psRGB = ImageCms.createProfile("sRGB")
|
||||
pLab = ImageCms.createProfile("LAB")
|
||||
t = ImageCms.buildTransform(pLab, psRGB, "LAB", "RGB")
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ValueError, match="mode mismatch"):
|
||||
t.apply_in_place(hopper("RGBA"))
|
||||
|
||||
# the procedural pyCMS API uses PyCMSError for all sorts of errors
|
||||
with hopper() as im:
|
||||
with pytest.raises(ImageCms.PyCMSError):
|
||||
with pytest.raises(ImageCms.PyCMSError, match="cannot open profile file"):
|
||||
ImageCms.profileToProfile(im, "foo", "bar")
|
||||
with pytest.raises(ImageCms.PyCMSError):
|
||||
|
||||
with pytest.raises(ImageCms.PyCMSError, match="cannot open profile file"):
|
||||
ImageCms.buildTransform("foo", "bar", "RGB", "RGB")
|
||||
with pytest.raises(ImageCms.PyCMSError):
|
||||
|
||||
with pytest.raises(ImageCms.PyCMSError, match="Invalid type for Profile"):
|
||||
ImageCms.getProfileName(None)
|
||||
skip_missing()
|
||||
with pytest.raises(ImageCms.PyCMSError):
|
||||
|
||||
with pytest.raises(
|
||||
ImageCms.PyCMSError,
|
||||
match="'NoneType' object cannot be interpreted as an integer",
|
||||
):
|
||||
ImageCms.isIntentSupported(SRGB, None, None)
|
||||
|
||||
|
||||
|
@ -201,12 +207,20 @@ def test_lab_color_profile():
|
|||
|
||||
|
||||
def test_unsupported_color_space():
|
||||
with pytest.raises(ImageCms.PyCMSError):
|
||||
with pytest.raises(
|
||||
ImageCms.PyCMSError,
|
||||
match=re.escape(
|
||||
"Color space not supported for on-the-fly profile creation (unsupported)"
|
||||
),
|
||||
):
|
||||
ImageCms.createProfile("unsupported")
|
||||
|
||||
|
||||
def test_invalid_color_temperature():
|
||||
with pytest.raises(ImageCms.PyCMSError):
|
||||
with pytest.raises(
|
||||
ImageCms.PyCMSError,
|
||||
match='Color temperature must be numeric, "invalid" not valid',
|
||||
):
|
||||
ImageCms.createProfile("LAB", "invalid")
|
||||
|
||||
|
||||
|
@ -470,9 +484,9 @@ def test_profile_typesafety():
|
|||
prepatch, these would segfault, postpatch they should emit a typeerror
|
||||
"""
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(TypeError, match="Invalid type for Profile"):
|
||||
ImageCms.ImageCmsProfile(0).tobytes()
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(TypeError, match="Invalid type for Profile"):
|
||||
ImageCms.ImageCmsProfile(1).tobytes()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user