@@ -1531,11 +1531,11 @@ def test_assign_vertices_center_Vector2(self):
15311531
15321532 self .assertEqual ((2.5 , 2.5 ), poly .center )
15331533
1534- def test_get_bounding_box_horizontal_line (self ):
1534+ def test_as_rect_horizontal_line (self ):
15351535 vertices = [(0 , 0 ), (1 , 0 ), (2 , 0 ), (3 , 0 )]
15361536 poly = Polygon (vertices )
15371537
1538- bounding_box = poly .get_bounding_box ()
1538+ bounding_box = poly .as_rect ()
15391539 expected_bounding_box = _calculate_bounding_box (vertices )
15401540
15411541 self .assertTrue (bounding_box .width > 0 )
@@ -1545,11 +1545,11 @@ def test_get_bounding_box_horizontal_line(self):
15451545 for vertex in vertices :
15461546 self .assertTrue (bounding_box .collidepoint (vertex ))
15471547
1548- def test_get_bounding_box_vertical_line (self ):
1548+ def test_as_rect_vertical_line (self ):
15491549 vertices = [(0 , 0 ), (0 , 1 ), (0 , 2 ), (0 , 3 )]
15501550 poly = Polygon (vertices )
15511551
1552- bounding_box = poly .get_bounding_box ()
1552+ bounding_box = poly .as_rect ()
15531553 expected_bounding_box = _calculate_bounding_box (vertices )
15541554
15551555 self .assertTrue (bounding_box .width > 0 )
@@ -1559,11 +1559,11 @@ def test_get_bounding_box_vertical_line(self):
15591559 for vertex in vertices :
15601560 self .assertTrue (bounding_box .collidepoint (vertex ))
15611561
1562- def test_get_bounding_box_square (self ):
1562+ def test_as_rect_square (self ):
15631563 vertices = [(0 , 0 ), (0 , 1 ), (1 , 1 ), (1 , 0 )]
15641564 poly = Polygon (vertices )
15651565
1566- bounding_box = poly .get_bounding_box ()
1566+ bounding_box = poly .as_rect ()
15671567 expected_bounding_box = _calculate_bounding_box (vertices )
15681568
15691569 self .assertTrue (bounding_box .width > 0 )
@@ -1573,11 +1573,11 @@ def test_get_bounding_box_square(self):
15731573 for vertex in vertices :
15741574 self .assertTrue (bounding_box .collidepoint (vertex ))
15751575
1576- def test_get_bounding_box_diagonal_line (self ):
1576+ def test_as_rect_diagonal_line (self ):
15771577 vertices = [(0 , 0 ), (1 , 1 ), (2 , 2 ), (3 , 3 )]
15781578 poly = Polygon (vertices )
15791579
1580- bounding_box = poly .get_bounding_box ()
1580+ bounding_box = poly .as_rect ()
15811581 expected_bounding_box = _calculate_bounding_box (vertices )
15821582
15831583 self .assertTrue (bounding_box .width > 0 )
@@ -1587,11 +1587,11 @@ def test_get_bounding_box_diagonal_line(self):
15871587 for vertex in vertices :
15881588 self .assertTrue (bounding_box .collidepoint (vertex ))
15891589
1590- def test_get_bounding_box_negative_positions (self ):
1590+ def test_as_rect_negative_positions (self ):
15911591 vertices = [(0.5 , 0.5 ), (- 0.5 , - 0.5 ), (1.5 , 1.5 ), (- 1.5 , - 1.5 )]
15921592 poly = Polygon (vertices )
15931593
1594- bounding_box = poly .get_bounding_box ()
1594+ bounding_box = poly .as_rect ()
15951595 expected_bounding_box = _calculate_bounding_box (vertices )
15961596
15971597 self .assertTrue (bounding_box .width > 0 )
@@ -1601,13 +1601,13 @@ def test_get_bounding_box_negative_positions(self):
16011601 for vertex in vertices :
16021602 self .assertTrue (bounding_box .collidepoint (vertex ))
16031603
1604- def test_get_bounding_box_nonsimple_random_positions (self ):
1604+ def test_as_rect_nonsimple_random_positions (self ):
16051605 vertices = []
16061606 for i in range (1000 ):
16071607 vertices .append ((random .uniform (- 100 , 100 ), random .uniform (- 100 , 100 )))
16081608 poly = Polygon (vertices )
16091609
1610- bounding_box = poly .get_bounding_box ()
1610+ bounding_box = poly .as_rect ()
16111611 expected_bounding_box = _calculate_bounding_box (vertices )
16121612
16131613 self .assertTrue (bounding_box .width > 0 )
@@ -1617,18 +1617,18 @@ def test_get_bounding_box_nonsimple_random_positions(self):
16171617 for vertex in vertices :
16181618 self .assertTrue (bounding_box .collidepoint (vertex ))
16191619
1620- def test_get_bounding_box_return_type (self ):
1621- """Tests whether the get_bounding_box method returns a Rect."""
1620+ def test_as_rect_return_type (self ):
1621+ """Tests whether the as_rect method returns a Rect."""
16221622 poly = Polygon (_some_vertices .copy ())
1623- self .assertIsInstance (poly .get_bounding_box (), Rect )
1623+ self .assertIsInstance (poly .as_rect (), Rect )
16241624
1625- def test_get_bounding_box_argnum (self ):
1626- """Tests whether the get_bounding_box method correctly handles invalid parameter
1625+ def test_as_rect_argnum (self ):
1626+ """Tests whether the as_rect method correctly handles invalid parameter
16271627 numbers."""
16281628 poly = Polygon (_some_vertices .copy ())
16291629
16301630 with self .assertRaises (TypeError ):
1631- poly .get_bounding_box (1 )
1631+ poly .as_rect (1 )
16321632
16331633 def test_assign_subscript (self ):
16341634 """Tests whether assigning to a subscript works correctly."""
0 commit comments