Added type hints

This commit is contained in:
Andrew Murray 2024-06-21 21:38:06 +10:00
parent e0a5d81127
commit 44da8b64c2

View File

@ -874,16 +874,20 @@ class TestFileTiff:
with Image.open(test_file):
pass
def test_open_tiff_uint16_multiband(self):
def test_open_tiff_uint16_multiband(self) -> None:
"""Test opening multiband TIFFs and reading all channels."""
def check_pixel(im: Image.Image, expected_pixel, pos: tuple[int, int]):
def check_pixel(
im: Image.Image, expected_pixel: tuple[int, ...], pos: tuple[int, int]
) -> None:
actual_pixel = im.getpixel((0, 0))
if isinstance(actual_pixel, int):
actual_pixel = (actual_pixel,)
assert actual_pixel == expected_pixel
def check_image(im: Image.Image, width: int, height: int, expected_pixel):
def check_image(
im: Image.Image, width: int, height: int, expected_pixel: tuple[int, ...]
) -> None:
assert im.width == width
assert im.height == height
for x in range(im.width):
@ -892,7 +896,7 @@ class TestFileTiff:
base_value = 4660
for i in range(1, 6):
pixel = tuple([base_value + j for j in range(0, i)])
pixel = tuple(base_value + j for j in range(i))
infile = f"Tests/images/uint16_{i}_{base_value}.tif"
im = Image.open(infile)