summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2012-10-07 20:08:31 -0700
committerJustin Bronn <jbronn@gmail.com>2012-10-07 20:08:31 -0700
commit75301d99d314a992a202fad64b2667528f9d51c8 (patch)
tree423b2dd9457ff821e01bce60d1a1c4af39a654d6
parent08eb54ae711ec087457333a259a7861eb5b39063 (diff)
Fixed `inspectapp` tests to work with improved PG driver in GDAL 1.9+.
-rw-r--r--django/contrib/gis/tests/inspectapp/tests.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/django/contrib/gis/tests/inspectapp/tests.py b/django/contrib/gis/tests/inspectapp/tests.py
index a3d19784c2..8fc39db58d 100644
--- a/django/contrib/gis/tests/inspectapp/tests.py
+++ b/django/contrib/gis/tests/inspectapp/tests.py
@@ -4,7 +4,7 @@ import os
from django.db import connections
from django.test import TestCase
-from django.contrib.gis.gdal import Driver
+from django.contrib.gis.gdal import Driver, GDAL_VERSION
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.utils.ogrinspect import ogrinspect
@@ -74,15 +74,33 @@ class OGRInspectTest(TestCase):
'',
'class Measurement(models.Model):',
' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)',
+ ]
+
+ if GDAL_VERSION < (1, 9, 0):
+ # Prior to GDAL 1.9, the order of the model fields was not
+ # the same as the columns in the database.
+ expected.extend([
' f_int = models.IntegerField()',
' f_datetime = models.DateTimeField()',
' f_time = models.TimeField()',
' f_float = models.FloatField()',
' f_char = models.CharField(max_length=10)',
' f_date = models.DateField()',
+ ])
+ else:
+ expected.extend([
+ ' f_float = models.FloatField()',
+ ' f_int = models.IntegerField()',
+ ' f_char = models.CharField(max_length=10)',
+ ' f_date = models.DateField()',
+ ' f_datetime = models.DateTimeField()',
+ ' f_time = models.TimeField()',
+ ])
+
+ expected.extend([
' geom = models.PolygonField()',
' objects = models.GeoManager()',
- ]
+ ])
self.assertEqual(model_def, '\n'.join(expected))