19
19
class TestColorLut3DCoreAPI :
20
20
def generate_identity_table (
21
21
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 ]]:
23
23
if isinstance (size , tuple ):
24
24
size_1d , size_2d , size_3d = size
25
25
else :
@@ -39,9 +39,7 @@ def generate_identity_table(
39
39
]
40
40
return (
41
41
channels ,
42
- size_1d ,
43
- size_2d ,
44
- size_3d ,
42
+ (size_1d , size_2d , size_3d ),
45
43
[item for sublist in table for item in sublist ],
46
44
)
47
45
@@ -89,21 +87,21 @@ def test_wrong_args(self) -> None:
89
87
90
88
with pytest .raises (ValueError , match = r"size1D \* size2D \* size3D" ):
91
89
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
93
91
)
94
92
95
93
with pytest .raises (ValueError , match = r"size1D \* size2D \* size3D" ):
96
94
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
98
96
)
99
97
100
98
with pytest .raises (TypeError ):
101
99
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
103
101
)
104
102
105
103
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 )
107
105
108
106
@pytest .mark .parametrize (
109
107
"lut_mode, table_channels, table_size" ,
@@ -264,7 +262,7 @@ def test_channels_order(self) -> None:
264
262
assert_image_equal (
265
263
Image .merge ('RGB' , im .split ()[::- 1 ]),
266
264
im ._new (im .im .color_lut_3d ('RGB' , Image .Resampling .BILINEAR ,
267
- 3 , 2 , 2 , 2 , [
265
+ 3 , ( 2 , 2 , 2 ) , [
268
266
0 , 0 , 0 , 0 , 0 , 1 ,
269
267
0 , 1 , 0 , 0 , 1 , 1 ,
270
268
@@ -286,7 +284,7 @@ def test_overflow(self) -> None:
286
284
287
285
# fmt: off
288
286
transformed = im ._new (im .im .color_lut_3d ('RGB' , Image .Resampling .BILINEAR ,
289
- 3 , 2 , 2 , 2 ,
287
+ 3 , ( 2 , 2 , 2 ) ,
290
288
[
291
289
- 1 , - 1 , - 1 , 2 , - 1 , - 1 ,
292
290
- 1 , 2 , - 1 , 2 , 2 , - 1 ,
@@ -307,7 +305,7 @@ def test_overflow(self) -> None:
307
305
308
306
# fmt: off
309
307
transformed = im ._new (im .im .color_lut_3d ('RGB' , Image .Resampling .BILINEAR ,
310
- 3 , 2 , 2 , 2 ,
308
+ 3 , ( 2 , 2 , 2 ) ,
311
309
[
312
310
- 3 , - 3 , - 3 , 5 , - 3 , - 3 ,
313
311
- 3 , 5 , - 3 , 5 , 5 , - 3 ,
0 commit comments