Skip to content

Commit ecf3a98

Browse files
authored
Merge pull request #8128 from radarhere/type_hint_gif
2 parents ba89023 + 9afe9d2 commit ecf3a98

File tree

5 files changed

+154
-96
lines changed

5 files changed

+154
-96
lines changed

Tests/test_file_gif.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def test_closed_file() -> None:
5353

5454
def test_seek_after_close() -> None:
5555
im = Image.open("Tests/images/iss634.gif")
56+
assert isinstance(im, GifImagePlugin.GifImageFile)
5657
im.load()
5758
im.close()
5859

@@ -377,7 +378,8 @@ def test_save_netpbm_bmp_mode(tmp_path: Path) -> None:
377378
img = img.convert("RGB")
378379

379380
tempfile = str(tmp_path / "temp.gif")
380-
GifImagePlugin._save_netpbm(img, 0, tempfile)
381+
b = BytesIO()
382+
GifImagePlugin._save_netpbm(img, b, tempfile)
381383
with Image.open(tempfile) as reloaded:
382384
assert_image_similar(img, reloaded.convert("RGB"), 0)
383385

@@ -388,7 +390,8 @@ def test_save_netpbm_l_mode(tmp_path: Path) -> None:
388390
img = img.convert("L")
389391

390392
tempfile = str(tmp_path / "temp.gif")
391-
GifImagePlugin._save_netpbm(img, 0, tempfile)
393+
b = BytesIO()
394+
GifImagePlugin._save_netpbm(img, b, tempfile)
392395
with Image.open(tempfile) as reloaded:
393396
assert_image_similar(img, reloaded.convert("L"), 0)
394397

@@ -648,7 +651,7 @@ def test_dispose2_palette(tmp_path: Path) -> None:
648651
assert rgb_img.getpixel((50, 50)) == circle
649652

650653
# Check that frame transparency wasn't added unnecessarily
651-
assert img._frame_transparency is None
654+
assert getattr(img, "_frame_transparency") is None
652655

653656

654657
def test_dispose2_diff(tmp_path: Path) -> None:

0 commit comments

Comments
 (0)