      def test_intersection(self):
          geom = Point(5, 23, srid=4326)
          qs = Country.objects.annotate(inter=functions.Intersection('mpoly', geom))
          for c in qs:
              if spatialite or mysql or oracle:
                  # When the intersection is empty, some databases return None.
                  expected = None
              else:
                  expected = c.mpoly.intersection(geom)
              self.assertEqual(c.inter, expected)
 
</s> remove from django.contrib.gis.db.models import aggregates
 </s> add from django.contrib.gis.db.models import GeometryField, aggregates
            if spatialite or (mysql and not connection.ops.uses_invalid_empty_geometry_collection) or oracle:
      def test_intersection(self):
          geom = Point(5, 23, srid=4326)
          qs = Country.objects.annotate(inter=functions.Intersection('mpoly', geom))
          for c in qs:
            if spatialite or (mysql and not connection.ops.uses_invalid_empty_geometry_collection) or oracle:
                  # When the intersection is empty, some databases return None.
                  expected = None
              else:
                  expected = c.mpoly.intersection(geom)
              self.assertEqual(c.inter, expected)
keep keep keep keep replace keep keep keep keep keep
 Refs #26657 -- Fixed a crash induced by invalid WKT returned by MySQL 5.7.5+. 
tests/gis_tests/geoapp/test_functions.py