  
          # Improper parameters.
          bad_params = (23, 'foo', 15.23)
          for bad in bad_params:
              self.assertRaises(GeoIP2Exception, GeoIP2, cache=bad)
              if isinstance(bad, six.string_types):
                  e = GeoIP2Exception
              else:
                  e = TypeError
              self.assertRaises(e, GeoIP2, bad, 0)
 
</s> remove             self.assertRaises(GeoIPException, GeoIP, cache=bad)
 </s> add             with self.assertRaises(GeoIPException):
                GeoIP(cache=bad) </s> remove             self.assertRaises(e, GeoIP2, bad, 0)
 </s> add             with self.assertRaises(e):
                GeoIP2(bad, 0) </s> remove             self.assertRaises(e, GeoIP, bad, 0)
 </s> add             with self.assertRaises(e):
                GeoIP(bad, 0) </s> remove             self.assertRaises(e, qs.count)
 </s> add             with self.assertRaises(e):
                qs.count() </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'))
            with self.assertRaises(GeoIP2Exception):
                GeoIP2(cache=bad)
  
          # Improper parameters.
          bad_params = (23, 'foo', 15.23)
          for bad in bad_params:
            with self.assertRaises(GeoIP2Exception):
                GeoIP2(cache=bad)
              if isinstance(bad, six.string_types):
                  e = GeoIP2Exception
              else:
                  e = TypeError
              self.assertRaises(e, GeoIP2, bad, 0)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/test_geoip2.py