def test_fit(self): # __doc__ (as of 2008-08-02) for pygame.rect.Rect.fit: # Rect.fit(Rect): return Rect # resize and move a rectangle with aspect ratio # # Returns a new rectangle that is moved and resized to fit another. # The aspect ratio of the original Rect is preserved, so the new # rectangle may be smaller than the target in either width or height. r = Rect(10, 10, 30, 30) r2 = Rect(30, 30, 15, 10) f = r.fit(r2) self.assertTrue(r2.contains(f)) f2 = r2.fit(r) self.assertTrue(r.contains(f2))