def test_pygame2_base_Rect_collidelistall(self): # __doc__ (as of 2008-10-17) for pygame2.base.Rect.collidelistall: # Rect.collidelistall (list) -> [index, ...] # # Test if all rectangles in a list intersect. # # Returns a list of all the indices that contain rectangles that # collide with the Rect. If no intersecting rectangles are # found, an empty list is returned. r = Rect(1, 1, 10, 10) l = [ Rect(1, 1, 10, 10), Rect(5, 5, 10, 10), Rect(15, 15, 1, 1), Rect(2, 2, 1, 1), ] self.assertEqual(r.collidelistall(l), [0, 1, 3]) self.assertEqual(r.collidelistall(l, lambda x, y: x.top >= y.top), [0,]) f = [Rect(50, 50, 1, 1), Rect(20, 20, 5, 5)] self.assertFalse(r.collidelistall(f))