From de6f27ef7f101d7a14da4a8f20f1090517e17908 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 16 Jan 2024 18:44:28 +1100 Subject: [PATCH] Test error is raised without LOAD_TRUNCATED_IMAGES --- Tests/test_file_png.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index aa2aac906f7..1e07df5742b 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -779,6 +779,10 @@ class MyStdOut: assert_image_equal_tofile(reloaded, TEST_PNG_FILE) def test_end_truncated_file(self): + with Image.open("Tests/images/end_trunc_file.png") as im: + with pytest.raises(OSError): + im.load() + ImageFile.LOAD_TRUNCATED_IMAGES = True try: with Image.open("Tests/images/end_trunc_file.png") as im: