diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index e5b3ada1a2b..52063d0374e 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -781,9 +781,8 @@ class MyStdOut: def test_end_truncated_filed(self): ImageFile.LOAD_TRUNCATED_IMAGES = True try: - img = Image.open("Tests/images/end_trunc_file.png") - img.load() - assert img is not None + with Image.open("Tests/images/end_trunc_file.png") as im: + assert_image_equal_tofile(im, "Tests/images/hopper.png") finally: ImageFile.LOAD_TRUNCATED_IMAGES = False