55import pytest
66from arcade import hitbox
77
8- points = [( 0.0 , 0.0 ), (0.0 , 10.0 ), (10.0 , 10.0 ), (10.0 , 0.0 )]
9- rot_90 = [( 0.0 , 0.0 ), (10.0 , 0 ), (10.0 , - 10.0 ), (0.0 , - 10.0 )]
8+ points = (( 0.0 , 0.0 ), (0.0 , 10.0 ), (10.0 , 10.0 ), (10.0 , 0.0 ))
9+ rot_90 = (( 0.0 , 0.0 ), (10.0 , 0 ), (10.0 , - 10.0 ), (0.0 , - 10.0 ))
1010
1111
1212def test_module ():
@@ -34,14 +34,14 @@ def test_scale():
3434 hb = hitbox .HitBox (points )
3535 hb .scale = (2.0 , 2.0 )
3636 assert hb .scale == (2.0 , 2.0 )
37- assert hb .get_adjusted_points () == [( 0.0 , 0.0 ), (0.0 , 20.0 ), (20.0 , 20.0 ), (20.0 , 0.0 )]
37+ assert hb .get_adjusted_points () == (( 0.0 , 0.0 ), (0.0 , 20.0 ), (20.0 , 20.0 ), (20.0 , 0.0 ))
3838
3939
4040def test_position ():
4141 hb = hitbox .HitBox (points )
4242 hb .position = (10.0 , 10.0 )
4343 assert hb .position == (10.0 , 10.0 )
44- assert hb .get_adjusted_points () == [( 10.0 , 10.0 ), (10.0 , 20.0 ), (20.0 , 20.0 ), (20.0 , 10.0 )]
44+ assert hb .get_adjusted_points () == (( 10.0 , 10.0 ), (10.0 , 20.0 ), (20.0 , 20.0 ), (20.0 , 10.0 ))
4545
4646
4747def test_rotation ():
@@ -74,8 +74,8 @@ def test_multi_region_create():
7474 assert hb .has_region ("body" )
7575 assert hb .has_region ("head" )
7676 assert not hb .has_region ("default" )
77- assert hb .regions ["body" ] == body_pts
78- assert hb .regions ["head" ] == head_pts
77+ assert hb .regions ["body" ] == tuple ( tuple ( p ) for p in body_pts )
78+ assert hb .regions ["head" ] == tuple ( tuple ( p ) for p in head_pts )
7979
8080
8181def test_multi_region_adjusted ():
@@ -84,8 +84,8 @@ def test_multi_region_adjusted():
8484 hb = hitbox .HitBox ({"body" : body_pts , "head" : head_pts }, position = (5.0 , 5.0 ))
8585 body_adj = hb .get_adjusted_points ("body" )
8686 head_adj = hb .get_adjusted_points ("head" )
87- assert body_adj == [( 5.0 , 5.0 ), (5.0 , 15.0 ), (15.0 , 15.0 ), (15.0 , 5.0 )]
88- assert head_adj == [( 7.0 , 15.0 ), (7.0 , 20.0 ), (13.0 , 20.0 ), (13.0 , 15.0 )]
87+ assert body_adj == (( 5.0 , 5.0 ), (5.0 , 15.0 ), (15.0 , 15.0 ), (15.0 , 5.0 ))
88+ assert head_adj == (( 7.0 , 15.0 ), (7.0 , 20.0 ), (13.0 , 20.0 ), (13.0 , 15.0 ))
8989
9090
9191def test_multi_region_boundaries ():
@@ -134,7 +134,7 @@ def test_single_region_fast_path():
134134 hb = hitbox .HitBox (points )
135135 polys = hb .get_all_adjusted_polygons ()
136136 assert len (polys ) == 1
137- assert polys [0 ] == list ( points )
137+ assert polys [0 ] == points
138138
139139
140140# --- Serialization tests ---
@@ -167,7 +167,7 @@ def test_from_dict():
167167 }
168168 hb = hitbox .HitBox .from_dict (d )
169169 assert hb .points == ((0.0 , 0.0 ), (0.0 , 10.0 ), (10.0 , 10.0 ), (10.0 , 0.0 ))
170- assert hb .get_adjusted_points () == [( 0.0 , 0.0 ), (0.0 , 10.0 ), (10.0 , 10.0 ), (10.0 , 0.0 )]
170+ assert hb .get_adjusted_points () == (( 0.0 , 0.0 ), (0.0 , 10.0 ), (10.0 , 10.0 ), (10.0 , 0.0 ))
171171
172172
173173def test_roundtrip_dict ():
0 commit comments