1919class TestColorLut3DCoreAPI :
2020 def generate_identity_table (
2121 self , channels : int , size : int | tuple [int , int , int ]
22- ) -> tuple [int , int , int , int , list [float ]]:
22+ ) -> tuple [int , tuple [ int , int , int ] , list [float ]]:
2323 if isinstance (size , tuple ):
2424 size_1d , size_2d , size_3d = size
2525 else :
@@ -39,9 +39,7 @@ def generate_identity_table(
3939 ]
4040 return (
4141 channels ,
42- size_1d ,
43- size_2d ,
44- size_3d ,
42+ (size_1d , size_2d , size_3d ),
4543 [item for sublist in table for item in sublist ],
4644 )
4745
@@ -89,21 +87,21 @@ def test_wrong_args(self) -> None:
8987
9088 with pytest .raises (ValueError , match = r"size1D \* size2D \* size3D" ):
9189 im .im .color_lut_3d (
92- "RGB" , Image .Resampling .BILINEAR , 3 , 2 , 2 , 2 , [0 , 0 , 0 ] * 7
90+ "RGB" , Image .Resampling .BILINEAR , 3 , ( 2 , 2 , 2 ) , [0 , 0 , 0 ] * 7
9391 )
9492
9593 with pytest .raises (ValueError , match = r"size1D \* size2D \* size3D" ):
9694 im .im .color_lut_3d (
97- "RGB" , Image .Resampling .BILINEAR , 3 , 2 , 2 , 2 , [0 , 0 , 0 ] * 9
95+ "RGB" , Image .Resampling .BILINEAR , 3 , ( 2 , 2 , 2 ) , [0 , 0 , 0 ] * 9
9896 )
9997
10098 with pytest .raises (TypeError ):
10199 im .im .color_lut_3d (
102- "RGB" , Image .Resampling .BILINEAR , 3 , 2 , 2 , 2 , [0 , 0 , "0" ] * 8
100+ "RGB" , Image .Resampling .BILINEAR , 3 , ( 2 , 2 , 2 ) , [0 , 0 , "0" ] * 8
103101 )
104102
105103 with pytest .raises (TypeError ):
106- im .im .color_lut_3d ("RGB" , Image .Resampling .BILINEAR , 3 , 2 , 2 , 2 , 16 )
104+ im .im .color_lut_3d ("RGB" , Image .Resampling .BILINEAR , 3 , ( 2 , 2 , 2 ) , 16 )
107105
108106 @pytest .mark .parametrize (
109107 "lut_mode, table_channels, table_size" ,
@@ -264,7 +262,7 @@ def test_channels_order(self) -> None:
264262 assert_image_equal (
265263 Image .merge ('RGB' , im .split ()[::- 1 ]),
266264 im ._new (im .im .color_lut_3d ('RGB' , Image .Resampling .BILINEAR ,
267- 3 , 2 , 2 , 2 , [
265+ 3 , ( 2 , 2 , 2 ) , [
268266 0 , 0 , 0 , 0 , 0 , 1 ,
269267 0 , 1 , 0 , 0 , 1 , 1 ,
270268
@@ -286,7 +284,7 @@ def test_overflow(self) -> None:
286284
287285 # fmt: off
288286 transformed = im ._new (im .im .color_lut_3d ('RGB' , Image .Resampling .BILINEAR ,
289- 3 , 2 , 2 , 2 ,
287+ 3 , ( 2 , 2 , 2 ) ,
290288 [
291289 - 1 , - 1 , - 1 , 2 , - 1 , - 1 ,
292290 - 1 , 2 , - 1 , 2 , 2 , - 1 ,
@@ -307,7 +305,7 @@ def test_overflow(self) -> None:
307305
308306 # fmt: off
309307 transformed = im ._new (im .im .color_lut_3d ('RGB' , Image .Resampling .BILINEAR ,
310- 3 , 2 , 2 , 2 ,
308+ 3 , ( 2 , 2 , 2 ) ,
311309 [
312310 - 3 , - 3 , - 3 , 5 , - 3 , - 3 ,
313311 - 3 , 5 , - 3 , 5 , 5 , - 3 ,
0 commit comments