diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 38d7033110c..bbdc5675a8f 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/end_trunc_file.png") finally: ImageFile.LOAD_TRUNCATED_IMAGES = False