          # Houston, Dallas -- Ordering may differ depending on backend or GEOS version.
          union1 = fromstr('MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)')
          union2 = fromstr('MULTIPOINT(-95.363151 29.763374,-96.801611 32.782057)')
          qs = City.objects.filter(point__within=tx)
          self.assertRaises(ValueError, qs.aggregate, Union('name'))
          # Using `field_name` keyword argument in one query and specifying an
          # order in the other (which should not be used because this is
          # an aggregate method on a spatial column)
          u1 = qs.aggregate(Union('point'))['point__union']
          u2 = qs.order_by('name').aggregate(Union('point'))['point__union']
 
</s> remove         self.assertRaises(LayerMapError, lm.save, fid_range=fr, step=10)
 </s> add         with self.assertRaises(LayerMapError):
            lm.save(fid_range=fr, step=10) </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(FieldError, test_gmbh.save)
 </s> add         with self.assertRaises(FieldError):
            test_gmbh.save() </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, Choice.objects.filter, id__gt=None)
 </s> add         with self.assertRaises(ValueError):
            Choice.objects.filter(id__gt=None)
        with self.assertRaises(ValueError):
            qs.aggregate(Union('name'))
          # Houston, Dallas -- Ordering may differ depending on backend or GEOS version.
          union1 = fromstr('MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)')
          union2 = fromstr('MULTIPOINT(-95.363151 29.763374,-96.801611 32.782057)')
          qs = City.objects.filter(point__within=tx)
        with self.assertRaises(ValueError):
            qs.aggregate(Union('name'))
          # Using `field_name` keyword argument in one query and specifying an
          # order in the other (which should not be used because this is
          # an aggregate method on a spatial column)
          u1 = qs.aggregate(Union('point'))['point__union']
          u2 = qs.order_by('name').aggregate(Union('point'))['point__union']
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