Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replaced proj4 testing by a regex

  • Loading branch information...
commit 8a92139d8a5c2ecb4a7a55da74d293c71390e9ed 1 parent cbfb8ed
@claudep claudep authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 django/contrib/gis/tests/test_spatialrefsys.py
View
15 django/contrib/gis/tests/test_spatialrefsys.py
@@ -2,6 +2,7 @@
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis,
spatialite, HAS_SPATIALREFSYS, SpatialRefSys)
+from django.utils import six
from django.utils import unittest
@@ -10,9 +11,8 @@
'auth_srid' : 4326,
# Only the beginning, because there are differences depending on installed libs
'srtext' : 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"',
- 'proj4' : ['+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ',
- # +ellps=WGS84 has been removed in the 4326 proj string in proj-4.8
- '+proj=longlat +datum=WGS84 +no_defs '],
+ # +ellps=WGS84 has been removed in the 4326 proj string in proj-4.8
+ 'proj4_re' : r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ',
'spheroid' : 'WGS 84', 'name' : 'WGS 84',
'geographic' : True, 'projected' : False, 'spatialite' : True,
'ellipsoid' : (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
@@ -22,8 +22,9 @@
'auth_name' : ('EPSG', False),
'auth_srid' : 32140,
'srtext' : 'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980"',
- 'proj4' : ['+proj=lcc +lat_1=30.28333333333333 +lat_2=28.38333333333333 +lat_0=27.83333333333333 +lon_0=-99 +x_0=600000 +y_0=4000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs ',
- '+proj=lcc +lat_1=30.28333333333333 +lat_2=28.38333333333333 +lat_0=27.83333333333333 +lon_0=-99 +x_0=600000 +y_0=4000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs '],
+ 'proj4_re' : r'\+proj=lcc \+lat_1=30.28333333333333 \+lat_2=28.38333333333333 \+lat_0=27.83333333333333 '
+ r'\+lon_0=-99 \+x_0=600000 \+y_0=4000000 \+ellps=GRS80 '
+ r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0)?\+units=m \+no_defs ',
'spheroid' : 'GRS 1980', 'name' : 'NAD83 / Texas South Central',
'geographic' : False, 'projected' : True, 'spatialite' : False,
'ellipsoid' : (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
@@ -54,7 +55,7 @@ def test01_retrieve(self):
# No proj.4 and different srtext on oracle backends :(
if postgis:
self.assertTrue(srs.wkt.startswith(sd['srtext']))
- self.assertTrue(srs.proj4text in sd['proj4'])
+ six.assertRegex(self, srs.proj4text, sd['proj4_re'])
@no_mysql
def test02_osr(self):
@@ -73,7 +74,7 @@ def test02_osr(self):
# Testing the SpatialReference object directly.
if postgis or spatialite:
srs = sr.srs
- self.assertTrue(srs.proj4 in sd['proj4'])
+ six.assertRegex(self, srs.proj4, sd['proj4_re'])
# No `srtext` field in the `spatial_ref_sys` table in SpatiaLite
if not spatialite:
self.assertTrue(srs.wkt.startswith(sd['srtext']))
Please sign in to comment.
Something went wrong with that request. Please try again.