mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
Raise DeprecationWarning on raise_ioerror
This commit is contained in:
parent
dda6145fce
commit
7bb51a4aca
|
@ -93,6 +93,11 @@ class TestImageFile:
|
||||||
|
|
||||||
assert_image_equal(im1, im2)
|
assert_image_equal(im1, im2)
|
||||||
|
|
||||||
|
def test_raise_ioerror(self):
|
||||||
|
with pytest.raises(IOError):
|
||||||
|
with pytest.raises(DeprecationWarning):
|
||||||
|
ImageFile.raise_ioerror(1)
|
||||||
|
|
||||||
def test_raise_oserror(self):
|
def test_raise_oserror(self):
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
ImageFile.raise_oserror(1)
|
ImageFile.raise_oserror(1)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
import io
|
import io
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
from . import Image
|
from . import Image
|
||||||
from ._util import isPath
|
from ._util import isPath
|
||||||
|
@ -64,6 +65,15 @@ def raise_oserror(error):
|
||||||
raise OSError(message + " when reading image file")
|
raise OSError(message + " when reading image file")
|
||||||
|
|
||||||
|
|
||||||
|
def raise_ioerror(error):
|
||||||
|
warnings.warn(
|
||||||
|
"raise_ioerror is deprecated and will be removed in a future release. "
|
||||||
|
"Use raise_oserror instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
|
return raise_oserror(error)
|
||||||
|
|
||||||
|
|
||||||
def _tilesort(t):
|
def _tilesort(t):
|
||||||
# sort on offset
|
# sort on offset
|
||||||
return t[2]
|
return t[2]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user