              # Testing the SpatialReference object directly.
              if postgis or spatialite:
                  srs = sr.srs
                  six.assertRegex(self, srs.proj4, sd['proj4_re'])
                  # No `srtext` field in the `spatial_ref_sys` table in SpatiaLite < 4
                  if not spatialite or connection.ops.spatial_version[0] >= 4:
                      self.assertTrue(srs.wkt.startswith(sd['srtext']))
  
      def test_ellipsoid(self):
          """
          Test the ellipsoid property.
          """
 
</s> remove 

def add_spatial_version_related_fields(sender, **kwargs):
    """
    Adds fields after establishing a database connection to prevent database
    operations at compile time.
    """
    if connection_created.disconnect(add_spatial_version_related_fields, sender=DatabaseWrapper):
        spatial_version = connection.ops.spatial_version[0]
        if spatial_version >= 4:
            SpatialiteSpatialRefSys.add_to_class('srtext', models.CharField(max_length=2048))
            SpatialiteGeometryColumns.add_to_class('type', models.IntegerField(db_column='geometry_type'))
        else:
            SpatialiteGeometryColumns.add_to_class('type', models.CharField(max_length=30))
connection_created.connect(add_spatial_version_related_fields, sender=DatabaseWrapper)
 </s> add  </s> remove             type_col = 'type' if self.connection.ops.spatial_version < (4, 0, 0) else 'geometry_type'
            cursor.execute('SELECT coord_dimension, srid, %s '
 </s> add             cursor.execute('SELECT coord_dimension, srid, geometry_type ' </s> remove                            'WHERE f_table_name=%%s AND f_geometry_column=%%s' % type_col,
 </s> add                            'WHERE f_table_name=%s AND f_geometry_column=%s', </s> remove         if version < (3, 0, 0):
            raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 3.0.0 and above.')
 </s> add         if version < (4, 0, 0):
            raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 4.0.0 and above.')
                self.assertTrue(srs.wkt.startswith(sd['srtext']))
              # Testing the SpatialReference object directly.
              if postgis or spatialite:
                  srs = sr.srs
                  six.assertRegex(self, srs.proj4, sd['proj4_re'])
                self.assertTrue(srs.wkt.startswith(sd['srtext']))
                self.assertTrue(srs.wkt.startswith(sd['srtext']))
                self.assertTrue(srs.wkt.startswith(sd['srtext']))
  
      def test_ellipsoid(self):
          """
          Test the ellipsoid property.
          """
keep keep keep keep replace replace replace keep keep keep keep keep
 Fixed #25645 -- Dropped support for SpatiaLite < 4.0. 
tests/gis_tests/test_spatialrefsys.py