summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-06-01 22:31:46 -0400
committerTim Graham <timograham@gmail.com>2018-06-01 22:38:49 -0400
commitd60d7d6d71018b17f01bbf0c390c7d929ff28310 (patch)
treef2b970b6b1af7af3be3e7820f82527a3c84cee7e
parent6f171c285ee5fc5af211597cae41dc724d4bc2eb (diff)
downloaddjango-d60d7d6d71018b17f01bbf0c390c7d929ff28310.tar.gz
[1.11.x] Fixed #29462 -- Fixed ogrinspect test failures with GDAL 2.2.
Backport of 55f4eee75d41499995bfdb611ac89e80c87404eb from master
-rw-r--r--tests/gis_tests/inspectapp/tests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py
index f971c85548..1e153fe772 100644
--- a/tests/gis_tests/inspectapp/tests.py
+++ b/tests/gis_tests/inspectapp/tests.py
@@ -62,6 +62,7 @@ class InspectDbTests(TestCase):
INSTALLED_APPS={'append': 'django.contrib.gis'},
)
class OGRInspectTest(TestCase):
+ expected_srid = 'srid=-1' if GDAL_VERSION < (2, 2) else ''
maxDiff = 1024
def test_poly(self):
@@ -76,7 +77,7 @@ class OGRInspectTest(TestCase):
' float = models.FloatField()',
' int = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),
' str = models.CharField(max_length=80)',
- ' geom = models.PolygonField(srid=-1)',
+ ' geom = models.PolygonField(%s)' % self.expected_srid,
]
self.assertEqual(model_def, '\n'.join(expected))
@@ -84,7 +85,7 @@ class OGRInspectTest(TestCase):
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(srid=-1)', model_def)
+ self.assertIn('geom = models.MultiPolygonField(%s)' % self.expected_srid, 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)
@@ -103,7 +104,7 @@ class OGRInspectTest(TestCase):
' population = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),
' density = models.FloatField()',
' created = models.DateField()',
- ' geom = models.PointField(srid=-1)',
+ ' geom = models.PointField(%s)' % self.expected_srid,
]
self.assertEqual(model_def, '\n'.join(expected))