Skip to content

Commit

Permalink
avif: Use Image.open context manager in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino and radarhere committed Mar 28, 2021
1 parent 1ccea31 commit 246384d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Tests/test_file_avif.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ def test_no_resource_warning(self, tmp_path):

def test_file_pointer_could_be_reused(self):
with open(TEST_AVIF_FILE, "rb") as blob:
Image.open(blob).load()
Image.open(blob).load()
with Image.open(blob) as im:
im.load()
with Image.open(blob) as im:
im.load()

def test_background_from_gif(self, tmp_path):
with Image.open("Tests/images/chi.gif") as im:
Expand All @@ -170,7 +172,8 @@ def test_background_from_gif(self, tmp_path):

# Save as GIF
out_gif = str(tmp_path / "temp.gif")
Image.open(out_avif).save(out_gif)
with Image.open(out_avif) as im:
im.save(out_gif)

with Image.open(out_gif) as reread:
reread_value = reread.convert("RGB").getpixel((1, 1))
Expand Down

0 comments on commit 246384d

Please sign in to comment.