          # preferable to a segmentation fault that commonly occurs when
          # a C method is given a NULL memory reference.
          for fg in (fg1, fg2):
              # Equivalent to `fg.ptr`
              self.assertRaises(GEOSException, fg._get_ptr)
  
          # Anything that is either not None or the acceptable pointer type will
          # result in a TypeError when trying to assign it to the `ptr` property.
          # Thus, memory addresses (integers) and pointers of the incorrect type
          # (in `bad_ptrs`) will not be allowed.
 
</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(exception, force_text, MyString())
 </s> add         with self.assertRaises(exception):
            force_text(MyString()) </s> remove         self.assertRaises(TypeError, qs.kml, 'name')
 </s> add         with self.assertRaises(TypeError):
            qs.kml('name') </s> remove         self.assertRaises(ValueError, Country.objects.filter, mpoly__relate=(23, 'foo'))
 </s> add         with self.assertRaises(ValueError):
            Country.objects.filter(mpoly__relate=(23, 'foo')) </s> remove         self.assertRaises(TypeError, qs.gml, field_name='name')
 </s> add         with self.assertRaises(TypeError):
            qs.gml(field_name='name')
            with self.assertRaises(GEOSException):
                fg._get_ptr()
          # preferable to a segmentation fault that commonly occurs when
          # a C method is given a NULL memory reference.
          for fg in (fg1, fg2):
              # Equivalent to `fg.ptr`
            with self.assertRaises(GEOSException):
                fg._get_ptr()
  
          # Anything that is either not None or the acceptable pointer type will
          # result in a TypeError when trying to assign it to the `ptr` property.
          # Thus, memory addresses (integers) and pointers of the incorrect type
          # (in `bad_ptrs`) will not be allowed.
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