mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Merge pull request #3111 from uploadcare/revert-valueerrors
Revert ValueErrors to RuntimeErrors in ImageMorph module
This commit is contained in:
commit
0b65d0791e
|
@ -288,13 +288,13 @@ class MorphTests(PillowTestCase):
|
||||||
imrgb = Image.new('RGB', (10, 10))
|
imrgb = Image.new('RGB', (10, 10))
|
||||||
iml = Image.new('L', (10, 10))
|
iml = Image.new('L', (10, 10))
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(RuntimeError):
|
||||||
_imagingmorph.apply(bytes(lut), imrgb.im.id, iml.im.id)
|
_imagingmorph.apply(bytes(lut), imrgb.im.id, iml.im.id)
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(RuntimeError):
|
||||||
_imagingmorph.apply(bytes(lut), iml.im.id, imrgb.im.id)
|
_imagingmorph.apply(bytes(lut), iml.im.id, imrgb.im.id)
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(RuntimeError):
|
||||||
_imagingmorph.match(bytes(lut), imrgb.im.id)
|
_imagingmorph.match(bytes(lut), imrgb.im.id)
|
||||||
|
|
||||||
# Should not raise
|
# Should not raise
|
||||||
|
|
|
@ -66,12 +66,12 @@ apply(PyObject *self, PyObject* args)
|
||||||
|
|
||||||
if (imgin->type != IMAGING_TYPE_UINT8 ||
|
if (imgin->type != IMAGING_TYPE_UINT8 ||
|
||||||
imgin->bands != 1) {
|
imgin->bands != 1) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Unsupported image type");
|
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (imgout->type != IMAGING_TYPE_UINT8 ||
|
if (imgout->type != IMAGING_TYPE_UINT8 ||
|
||||||
imgout->bands != 1) {
|
imgout->bands != 1) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Unsupported image type");
|
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ match(PyObject *self, PyObject* args)
|
||||||
|
|
||||||
if (imgin->type != IMAGING_TYPE_UINT8 ||
|
if (imgin->type != IMAGING_TYPE_UINT8 ||
|
||||||
imgin->bands != 1) {
|
imgin->bands != 1) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Unsupported image type");
|
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user