66
77from PIL import CurImagePlugin , Image
88
9+ from .helper import assert_image_equal_tofile
910
10- def test_deerstalker () -> None :
11+
12+ def test_sanity () -> None :
1113 with Image .open ("Tests/images/cur/deerstalker.cur" ) as im :
1214 assert im .size == (32 , 32 )
1315 assert im .info ["hotspots" ] == [(0 , 0 )]
1416 assert isinstance (im , CurImagePlugin .CurImageFile )
15- # Check some pixel colors to ensure image is loaded properly
17+
18+ # Check pixel colors to ensure image is loaded properly
1619 assert im .getpixel ((10 , 1 )) == (0 , 0 , 0 , 0 )
1720 assert im .getpixel ((11 , 1 )) == (253 , 254 , 254 , 1 )
1821 assert im .getpixel ((16 , 16 )) == (84 , 87 , 86 , 255 )
@@ -23,7 +26,8 @@ def test_posy_link() -> None:
2326 assert im .size == (128 , 128 )
2427 assert im .info ["sizes" ] == {(128 , 128 ), (96 , 96 ), (64 , 64 ), (48 , 48 ), (32 , 32 )}
2528 assert im .info ["hotspots" ] == [(25 , 7 ), (18 , 5 ), (12 , 3 ), (9 , 2 ), (5 , 1 )]
26- # check some pixel colors
29+
30+ # check pixel colors
2731 assert im .getpixel ((0 , 0 )) == (0 , 0 , 0 , 0 )
2832 assert im .getpixel ((20 , 20 )) == (0 , 0 , 0 , 255 )
2933 assert im .getpixel ((40 , 40 )) == (255 , 255 , 255 , 255 )
@@ -79,9 +83,7 @@ def test_save_win98_arrow() -> None:
7983 hotspots = [(10 , 10 )],
8084 bitmap_format = "bmp" ,
8185 )
82-
83- with Image .open (output ) as reloaded :
84- assert im .tobytes () == reloaded .tobytes ()
86+ assert_image_equal_tofile (im , output )
8587
8688 with BytesIO () as output :
8789 im .save (output , format = "CUR" )
@@ -120,11 +122,10 @@ def test_save_posy_link() -> None:
120122 # make sure saved output is readable
121123 # and sizes/hotspots are correct
122124 with Image .open (output , formats = ["CUR" ]) as reloaded :
123- assert (48 , 48 ) == reloaded . size
124- assert set ( sizes [ 3 :]) == reloaded .info ["sizes" ]
125+ assert reloaded . size == (48 , 48 )
126+ assert reloaded .info ["sizes" ] == set ( sizes [ 3 :])
125127
126- # make sure error is thrown when size and hotspot len's
127- # don't match
128+ # check error is thrown when size and hotspot length don't match
128129 with pytest .raises (ValueError ):
129130 im .save (
130131 output ,
0 commit comments