Merge pull request #3111 from uploadcare/revert-valueerrors

Revert ValueErrors to RuntimeErrors in ImageMorph module
This commit is contained in:
Hugo 2018-04-22 22:27:20 +03:00 committed by GitHub
commit 0b65d0791e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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;
} }