          pnt2 = fromstr('POINT(-98.4919715741052 29.4333344025053)', srid=4326)
  
          # Not passing in a geometry as first param should
          # raise a type error when initializing the GeoQuerySet
          self.assertRaises(ValueError, Country.objects.filter, mpoly__relate=(23, 'foo'))
  
          # Making sure the right exception is raised for the given
          # bad arguments.
          for bad_args, e in [((pnt1, 0), ValueError), ((pnt2, 'T*T***FF*', 0), ValueError)]:
              qs = Country.objects.filter(mpoly__relate=bad_args)
 
</s> remove             self.assertRaises(e, qs.count)
 </s> add             with self.assertRaises(e):
                qs.count() </s> remove             self.assertRaises(GEOSException, fg._get_ptr)
 </s> add             with self.assertRaises(GEOSException):
                fg._get_ptr() </s> remove         self.assertRaises(TypeError, qs.kml, 'name')
 </s> add         with self.assertRaises(TypeError):
            qs.kml('name') </s> remove             self.assertRaises(TypeError, lm.save, fid_range=bad)
 </s> add             with self.assertRaises(TypeError):
                lm.save(fid_range=bad) </s> remove         self.assertRaises(MissingForeignKey, lm.save, silent=True, strict=True)
 </s> add         with self.assertRaises(MissingForeignKey):
            lm.save(silent=True, strict=True)
        with self.assertRaises(ValueError):
            Country.objects.filter(mpoly__relate=(23, 'foo'))
          pnt2 = fromstr('POINT(-98.4919715741052 29.4333344025053)', srid=4326)
  
          # Not passing in a geometry as first param should
          # raise a type error when initializing the GeoQuerySet
        with self.assertRaises(ValueError):
            Country.objects.filter(mpoly__relate=(23, 'foo'))
  
          # Making sure the right exception is raised for the given
          # bad arguments.
          for bad_args, e in [((pnt1, 0), ValueError), ((pnt2, 'T*T***FF*', 0), ValueError)]:
              qs = Country.objects.filter(mpoly__relate=bad_args)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/geoapp/tests.py