@@ -100,17 +100,17 @@ def test_not_equal(mode):
100
100
assert img_a .im != img_b .im
101
101
102
102
103
- @pytest .mark .skip (reason = "no way to directly set C bytes from Python" )
104
- @pytest .mark .parametrize ("mode" , ("RGB" , "RGBX" , "YCbCr" , "HSV" , "LAB" ))
105
- def test_equal_three_channels_four_bytes (mode ):
106
- img_a = Image .frombytes ("RGBA" , (2 , 2 ), b"ABC1DEF2GHI3JKL4" )
107
- img_b = Image .frombytes ("RGBA" , (2 , 2 ), b"ABC5DEF6GHI7JKL8" )
108
- # this only sets the mode in Python, not C
109
- img_a .mode = mode
110
- img_b .mode = mode
103
+ @pytest .mark .parametrize (
104
+ ("mode" , "rawmode" ),
105
+ (("RGB" , "RGBX" ), ("YCbCr" , "YCbCrX" ), ("HSV" , None ), ("LAB" , None )),
106
+ )
107
+ def test_equal_three_channels_four_bytes (mode , rawmode ):
108
+ if rawmode is None :
109
+ pytest .skip ("no 4-byte rawmode for " + mode )
110
+ img_a = Image .frombytes (mode , (2 , 2 ), b"ABC1DEF2GHI3JKL4" , "raw" , rawmode )
111
+ img_b = Image .frombytes (mode , (2 , 2 ), b"ABC5DEF6GHI7JKL8" , "raw" , rawmode )
111
112
assert img_a .tobytes () == b"ABCDEFGHIJKL"
112
113
assert img_b .tobytes () == b"ABCDEFGHIJKL"
113
- # this fails because the C code still thinks the mode is RGBA
114
114
assert img_a .im == img_b .im
115
115
116
116
0 commit comments