From 44da8b64c2d93efe1cf0deec3e1d092d724b5419 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 21 Jun 2024 21:38:06 +1000 Subject: [PATCH] Added type hints --- Tests/test_file_tiff.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 6f00afdac..d562b6fd0 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -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)