Skip to content

Commit

Permalink
Fixed unclosed file warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 19, 2025
1 parent cf7dd2f commit 2c0fe60
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,13 +1103,15 @@ def test_exif_transpose(self) -> None:
)
def test_buffering(self, test_file: str) -> None:
# load exif first
with Image.open(open(test_file, "rb", buffering=1048576)) as im:
exif = dict(im.getexif())
with open(test_file, "rb", buffering=1048576) as f:
with Image.open(f) as im:
exif = dict(im.getexif())

# load image before exif
with Image.open(open(test_file, "rb", buffering=1048576)) as im2:
im2.load()
exif_after_load = dict(im2.getexif())
with open(test_file, "rb", buffering=1048576) as f:
with Image.open(f) as im2:
im2.load()
exif_after_load = dict(im2.getexif())

assert exif == exif_after_load

Expand Down

0 comments on commit 2c0fe60

Please sign in to comment.