Skip to content

Commit a66d0d1

Browse files
committed
Assert getpalette does not return None
1 parent 755ebb8 commit a66d0d1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Tests/test_image_putpalette.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_putpalette_with_alpha_values() -> None:
6262
expected = im.convert("RGBA")
6363

6464
palette = im.getpalette()
65+
assert palette is not None
6566
transparency = im.info.pop("transparency")
6667

6768
palette_with_alpha_values = []

Tests/test_imagesequence.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ def test_consecutive() -> None:
7676
def test_palette_mmap() -> None:
7777
# Using mmap in ImageFile can require to reload the palette.
7878
with Image.open("Tests/images/multipage-mmap.tiff") as im:
79-
color1 = im.getpalette()[:3]
79+
palette = im.getpalette()
80+
assert palette is not None
81+
color1 = palette[:3]
8082
im.seek(0)
81-
color2 = im.getpalette()[:3]
83+
84+
palette = im.getpalette()
85+
assert palette is not None
86+
color2 = palette[:3]
8287
assert color1 == color2
8388

8489

0 commit comments

Comments
 (0)