mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #33453 -- Dropped support for GDAL 2.1.
This commit is contained in:
@@ -60,7 +60,6 @@ class InspectDbTests(TestCase):
|
||||
INSTALLED_APPS={'append': 'django.contrib.gis'},
|
||||
)
|
||||
class OGRInspectTest(SimpleTestCase):
|
||||
expected_srid = 'srid=-1' if GDAL_VERSION < (2, 2) else ''
|
||||
maxDiff = 1024
|
||||
|
||||
def test_poly(self):
|
||||
@@ -76,7 +75,7 @@ class OGRInspectTest(SimpleTestCase):
|
||||
' float = models.FloatField()',
|
||||
' int = models.BigIntegerField()',
|
||||
' str = models.CharField(max_length=80)',
|
||||
' geom = models.PolygonField(%s)' % self.expected_srid,
|
||||
' geom = models.PolygonField()',
|
||||
]
|
||||
|
||||
self.assertEqual(model_def, '\n'.join(expected))
|
||||
@@ -84,7 +83,7 @@ class OGRInspectTest(SimpleTestCase):
|
||||
def test_poly_multi(self):
|
||||
shp_file = os.path.join(TEST_DATA, 'test_poly', 'test_poly.shp')
|
||||
model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True)
|
||||
self.assertIn('geom = models.MultiPolygonField(%s)' % self.expected_srid, model_def)
|
||||
self.assertIn('geom = models.MultiPolygonField()', model_def)
|
||||
# Same test with a 25D-type geometry field
|
||||
shp_file = os.path.join(TEST_DATA, 'gas_lines', 'gas_leitung.shp')
|
||||
model_def = ogrinspect(shp_file, 'MyModel', multi_geom=True)
|
||||
@@ -105,7 +104,7 @@ class OGRInspectTest(SimpleTestCase):
|
||||
' population = models.BigIntegerField()',
|
||||
' density = models.FloatField()',
|
||||
' created = models.DateField()',
|
||||
' geom = models.PointField(%s)' % self.expected_srid,
|
||||
' geom = models.PointField()',
|
||||
]
|
||||
|
||||
self.assertEqual(model_def, '\n'.join(expected))
|
||||
@@ -165,7 +164,7 @@ class OGRInspectTest(SimpleTestCase):
|
||||
|
||||
def test_mapping_option(self):
|
||||
expected = (
|
||||
" geom = models.PointField(%s)\n"
|
||||
" geom = models.PointField()\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"# Auto-generated `LayerMapping` dictionary for City model\n"
|
||||
@@ -175,7 +174,7 @@ class OGRInspectTest(SimpleTestCase):
|
||||
" 'density': 'Density',\n"
|
||||
" 'created': 'Created',\n"
|
||||
" 'geom': 'POINT',\n"
|
||||
"}\n" % self.expected_srid)
|
||||
"}\n")
|
||||
shp_file = os.path.join(TEST_DATA, 'cities', 'cities.shp')
|
||||
out = StringIO()
|
||||
call_command('ogrinspect', shp_file, '--mapping', 'City', stdout=out)
|
||||
|
||||
Reference in New Issue
Block a user