          for geom in (g1, g2):
              self.assertEqual(ref, geom)
  
          # Should only accept six.string_types objects.
          self.assertRaises(TypeError, wkt_r.read, 1)
          self.assertRaises(TypeError, wkt_r.read, memoryview(b'foo'))
  
      def test02_wktwriter(self):
          # Creating a WKTWriter instance, testing its ptr property.
          wkt_w = WKTWriter()
          self.assertRaises(TypeError, wkt_w._set_ptr, WKTReader.ptr_type())
 
</s> remove         self.assertRaises(TypeError, wkt_w._set_ptr, WKTReader.ptr_type())
 </s> add         with self.assertRaises(TypeError):
            wkt_w._set_ptr(WKTReader.ptr_type()) </s> remove             self.assertRaises(TypeError, wkb_r.read, bad_wkb)
 </s> add             with self.assertRaises(TypeError):
                wkb_r.read(bad_wkb) </s> remove         self.assertRaises(TypeError, GEOSGeometry, None)
 </s> add         with self.assertRaises(TypeError):
            GEOSGeometry(None) </s> remove             self.assertRaises(TypeError, fg1._set_ptr, bad_ptr)
            self.assertRaises(TypeError, fg2._set_ptr, bad_ptr)
 </s> add             with self.assertRaises(TypeError):
                fg1._set_ptr(bad_ptr)
            with self.assertRaises(TypeError):
                fg2._set_ptr(bad_ptr) </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)))
        with self.assertRaises(TypeError):
            wkt_r.read(1)
        with self.assertRaises(TypeError):
            wkt_r.read(memoryview(b'foo'))
          for geom in (g1, g2):
              self.assertEqual(ref, geom)
  
          # Should only accept six.string_types objects.
        with self.assertRaises(TypeError):
            wkt_r.read(1)
        with self.assertRaises(TypeError):
            wkt_r.read(memoryview(b'foo'))
        with self.assertRaises(TypeError):
            wkt_r.read(1)
        with self.assertRaises(TypeError):
            wkt_r.read(memoryview(b'foo'))
  
      def test02_wktwriter(self):
          # Creating a WKTWriter instance, testing its ptr property.
          wkt_w = WKTWriter()
          self.assertRaises(TypeError, wkt_w._set_ptr, WKTReader.ptr_type())
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/geos_tests/test_io.py