              if mp.valid:
                  self.assertEqual(mp.num_geom, mpoly.num_geom)
                  self.assertEqual(mp.n_p, mpoly.num_coords)
                  self.assertEqual(mp.num_geom, len(mpoly))
                  self.assertRaises(IndexError, mpoly.__getitem__, len(mpoly))
                  for p in mpoly:
                      self.assertEqual(p.geom_type, 'Polygon')
                      self.assertEqual(p.geom_typeid, 3)
                      self.assertEqual(p.valid, True)
                  self.assertEqual(mpoly.wkt, MultiPolygon(*tuple(poly.clone() for poly in mpoly)).wkt)
 
</s> remove             self.assertRaises(IndexError, mpnt.__getitem__, len(mpnt))
 </s> add             with self.assertRaises(IndexError):
                mpnt.__getitem__(len(mpnt)) </s> remove         self.assertRaises(IndexError, p._checkindex, 2)
        self.assertRaises(IndexError, p._checkindex, -3)
 </s> add         with self.assertRaises(IndexError):
            p._checkindex(2)
        with self.assertRaises(IndexError):
            p._checkindex(-3) </s> remove             self.assertRaises(TypeError, poly.__setitem__, 0, LineString((1, 1), (2, 2)))
 </s> add             with self.assertRaises(TypeError):
                poly.__setitem__(0, LineString((1, 1), (2, 2))) </s> remove         self.assertRaises(TypeError, Point, range(1))
        self.assertRaises(TypeError, Point, range(4))
 </s> add         with self.assertRaises(TypeError):
            Point(range(1))
        with self.assertRaises(TypeError):
            Point(range(4)) </s> remove         self.assertRaises(AttributeError, q.setlist, 'foo', ['bar', 'baz'])
        self.assertRaises(AttributeError, q.setlist, 'foo', ['bar', 'baz'])
        self.assertRaises(AttributeError, q.appendlist, 'foo', ['bar'])
 </s> add         with self.assertRaises(AttributeError):
            q.setlist('foo', ['bar', 'baz'])
        with self.assertRaises(AttributeError):
            q.setlist('foo', ['bar', 'baz'])
        with self.assertRaises(AttributeError):
            q.appendlist('foo', ['bar'])
                with self.assertRaises(IndexError):
                    mpoly.__getitem__(len(mpoly))
              if mp.valid:
                  self.assertEqual(mp.num_geom, mpoly.num_geom)
                  self.assertEqual(mp.n_p, mpoly.num_coords)
                  self.assertEqual(mp.num_geom, len(mpoly))
                with self.assertRaises(IndexError):
                    mpoly.__getitem__(len(mpoly))
                  for p in mpoly:
                      self.assertEqual(p.geom_type, 'Polygon')
                      self.assertEqual(p.geom_typeid, 3)
                      self.assertEqual(p.valid, True)
                  self.assertEqual(mpoly.wkt, MultiPolygon(*tuple(poly.clone() for poly in mpoly)).wkt)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/geos_tests/test_geos.py