def test_union__list( self ): r1 = Rect( 0, 0, 1, 1 ) r2 = Rect( -2, -2, 1, 1 ) r3 = Rect( 2, 2, 1, 1 ) r4 = r1.union( [r2,r3] ) self.assertEqual( Rect(-2, -2, 5, 5), r4 )
def test_pygame2_base_Rect_union(self): # __doc__ (as of 2008-10-17) for pygame2.base.Rect.union: # Rect.union (Rect) -> Rect # # Joins two rectangles into one. # # Returns a new rectangle that completely covers the area of the # two provided rectangles. There may be area inside the new Rect # that is not covered by the originals. r1 = Rect( 1, 1, 1, 2 ) r2 = Rect( -2, -2, 1, 2 ) self.assertEqual( Rect( -2, -2, 4, 5 ), r1.union(r2) )
def test_union__with_identical_Rect( self ): r1 = Rect( 1, 2, 3, 4 ) self.assertEqual( r1, r1.union( Rect(r1) ) )