mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Merge pull request #1 from radarhere/truncated
Test error is raised without LOAD_TRUNCATED_IMAGES
This commit is contained in:
commit
6c55dff8af
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
@ -778,11 +778,15 @@ class TestFilePng:
|
||||||
with Image.open(mystdout) as reloaded:
|
with Image.open(mystdout) as reloaded:
|
||||||
assert_image_equal_tofile(reloaded, TEST_PNG_FILE)
|
assert_image_equal_tofile(reloaded, TEST_PNG_FILE)
|
||||||
|
|
||||||
def test_end_truncated_file(self):
|
def test_truncated_end_chunk(self):
|
||||||
|
with Image.open("Tests/images/truncated_end_chunk.png") as im:
|
||||||
|
with pytest.raises(OSError):
|
||||||
|
im.load()
|
||||||
|
|
||||||
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||||
try:
|
try:
|
||||||
with Image.open("Tests/images/end_trunc_file.png") as im:
|
with Image.open("Tests/images/truncated_end_chunk.png") as im:
|
||||||
assert_image_equal_tofile(im, "Tests/images/end_trunc_file.png")
|
assert_image_equal_tofile(im, "Tests/images/hopper.png")
|
||||||
finally:
|
finally:
|
||||||
ImageFile.LOAD_TRUNCATED_IMAGES = False
|
ImageFile.LOAD_TRUNCATED_IMAGES = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user