Changeset 7441
- Timestamp:
- 04/22/08 13:14:29 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/tests/geoapp/tests.py
r7028 r7441 2 2 from models import Country, City, State, Feature 3 3 from django.contrib.gis import gdal 4 from django.contrib.gis.db.backend import SpatialBackend 4 5 from django.contrib.gis.geos import * 5 6 from django.contrib.gis.measure import Distance … … 124 125 self.assertRaises(TypeError, qs.kml, 'name') 125 126 127 # The reference KML depends on the version of PostGIS used 128 # (the output stopped including altitude in 1.3.3). 129 major, minor1, minor2 = SpatialBackend.version 130 ref_kml1 = '<Point><coordinates>-104.609252,38.255001,0</coordinates></Point>' 131 ref_kml2 = '<Point><coordinates>-104.609252,38.255001</coordinates></Point>' 132 if major == 1: 133 if minor1 > 3 or (minor1 == 3 and minor2 >= 3): ref_kml = ref_kml2 134 else: ref_kml = ref_kml1 135 else: 136 ref_kml = ref_kml2 137 126 138 # Ensuring the KML is as expected. 127 139 ptown1 = City.objects.kml('point', precision=9).get(name='Pueblo') 128 140 ptown2 = City.objects.kml(precision=9).get(name='Pueblo') 129 141 for ptown in [ptown1, ptown2]: 130 self.assertEqual( '<Point><coordinates>-104.609252,38.255001,0</coordinates></Point>', ptown.kml)142 self.assertEqual(ref_kml, ptown.kml) 131 143 132 144 def test03b_gml(self): django/branches/gis/django/contrib/gis/tests/test_gdal_geom.py
r7406 r7441 1 1 import unittest 2 2 from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, \ 3 OGRException, OGRIndexError, SpatialReference, CoordTransform 3 OGRException, OGRIndexError, SpatialReference, CoordTransform, \ 4 gdal_version 4 5 from django.contrib.gis.tests.geometries import * 5 6 … … 197 198 print "\nEND - expecting IllegalArgumentException; safe to ignore.\n" 198 199 199 # Closing the rings 200 # Closing the rings -- doesn't work on GDAL versions 1.4.1 and below: 201 # http://trac.osgeo.org/gdal/ticket/1673 202 major, minor1, minor2 = gdal_version().split('.') 203 if major == '1': 204 iminor1 = int(minor1) 205 if iminor1 < 4 or (iminor1 == 4 and minor2.startswith('1')): return 200 206 poly.close_rings() 201 207 self.assertEqual(10, poly.point_count) # Two closing points should've been added
