          self.assertRaises(ValueError, City.objects.filter(point__contained=z.poly).count)
  
          # Regression test for #14060, `~=` was never really implemented for PostGIS.
          htown = City.objects.get(name='Houston')
          self.assertRaises(ValueError, City.objects.get, point__exact=htown.point)
  
      @skipUnless(HAS_GDAL, "GDAL is required.")
      def test05_geography_layermapping(self):
          "Testing LayerMapping support on models with geography fields."
          # There is a similar test in `layermap` that uses the same data set,
 
</s> remove         self.assertRaises(ValueError, City.objects.filter(point__contained=z.poly).count)
 </s> add         with self.assertRaises(ValueError):
            City.objects.filter(point__contained=z.poly).count() </s> remove         self.assertRaises(ValueError, City.objects.filter(point__within=z.poly).count)
 </s> add         with self.assertRaises(ValueError):
            City.objects.filter(point__within=z.poly).count() </s> remove         self.assertRaises(ValueError, Author.objects.annotate, friends=Count('friends'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(friends=Count('friends')) </s> remove         self.assertRaises(ValueError, Author.objects.annotate, book_contact_set=Avg('friends__age'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(book_contact_set=Avg('friends__age')) </s> remove         self.assertRaises(ValueError, Author.objects.annotate, age=Avg('friends__age'))
 </s> add         with self.assertRaises(ValueError):
            Author.objects.annotate(age=Avg('friends__age'))
        with self.assertRaises(ValueError):
            City.objects.get(point__exact=htown.point)
          self.assertRaises(ValueError, City.objects.filter(point__contained=z.poly).count)
  
          # Regression test for #14060, `~=` was never really implemented for PostGIS.
          htown = City.objects.get(name='Houston')
        with self.assertRaises(ValueError):
            City.objects.get(point__exact=htown.point)
  
      @skipUnless(HAS_GDAL, "GDAL is required.")
      def test05_geography_layermapping(self):
          "Testing LayerMapping support on models with geography fields."
          # There is a similar test in `layermap` that uses the same data set,
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/geogapp/tests.py