Replaced OSError with more specific UnidentifiedImageError

This commit is contained in:
Andrew Murray 2020-06-20 09:51:48 +10:00
parent 3e9068a345
commit abbc890b20

View File

@ -3,7 +3,7 @@ import re
from io import BytesIO from io import BytesIO
import pytest import pytest
from PIL import ExifTags, Image, ImageFile, JpegImagePlugin from PIL import ExifTags, Image, ImageFile, JpegImagePlugin, UnidentifiedImageError
from .helper import ( from .helper import (
assert_image, assert_image,
@ -718,7 +718,7 @@ class TestFileJpeg:
return res return res
buffer.read = read buffer.read = read
with pytest.raises(OSError): with pytest.raises(UnidentifiedImageError):
Image.open(buffer) Image.open(buffer)
# Assert the entire file has not been read # Assert the entire file has not been read