Skip to content

Commit 6c55dff

Browse files
authored
Merge pull request #1 from radarhere/truncated
Test error is raised without LOAD_TRUNCATED_IMAGES
2 parents b2711c3 + 62e6d62 commit 6c55dff

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Tests/test_file_png.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,11 +778,15 @@ class MyStdOut:
778778
with Image.open(mystdout) as reloaded:
779779
assert_image_equal_tofile(reloaded, TEST_PNG_FILE)
780780

781-
def test_end_truncated_file(self):
781+
def test_truncated_end_chunk(self):
782+
with Image.open("Tests/images/truncated_end_chunk.png") as im:
783+
with pytest.raises(OSError):
784+
im.load()
785+
782786
ImageFile.LOAD_TRUNCATED_IMAGES = True
783787
try:
784-
with Image.open("Tests/images/end_trunc_file.png") as im:
785-
assert_image_equal_tofile(im, "Tests/images/end_trunc_file.png")
788+
with Image.open("Tests/images/truncated_end_chunk.png") as im:
789+
assert_image_equal_tofile(im, "Tests/images/hopper.png")
786790
finally:
787791
ImageFile.LOAD_TRUNCATED_IMAGES = False
788792

0 commit comments

Comments
 (0)