summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2007-12-27 21:44:33 +0000
committerJustin Bronn <jbronn@gmail.com>2007-12-27 21:44:33 +0000
commit387e6cca92bfc4286d9a4a3290d1077f9eefba31 (patch)
tree37600289acf8b2638c0300fd926cff26f25c8dae
parent31111857cb0aebcda101f4213688358d13ed96e2 (diff)
gis: lowered test transformation precision due to variations in updated PROJ and GDAL versions (i.e., tests run for GDAL 1.5 and PROJ 4.6.0).
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/gis/tests/geoapp/tests.py9
-rw-r--r--django/contrib/gis/tests/test_gdal_geom.py9
2 files changed, 10 insertions, 8 deletions
diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py
index 574cc8fff6..6533319885 100644
--- a/django/contrib/gis/tests/geoapp/tests.py
+++ b/django/contrib/gis/tests/geoapp/tests.py
@@ -155,21 +155,22 @@ class GeoModelTest(unittest.TestCase):
# Pre-transformed points for Houston and Pueblo.
htown = fromstr('POINT(1947516.83115183 6322297.06040572)', srid=3084)
ptown = fromstr('POINT(992363.390841912 481455.395105533)', srid=2774)
+ prec = 3 # Precision is low due to version variations in PROJ and GDAL.
# Asserting the result of the transform operation with the values in
# the pre-transformed points. Oracle does not have the 3084 SRID.
if not oracle:
h = City.objects.transform('point', srid=htown.srid).get(name='Houston')
self.assertEqual(3084, h.point.srid)
- self.assertAlmostEqual(htown.x, h.point.x, 8)
- self.assertAlmostEqual(htown.y, h.point.y, 8)
+ self.assertAlmostEqual(htown.x, h.point.x, prec)
+ self.assertAlmostEqual(htown.y, h.point.y, prec)
p1 = City.objects.transform('point', srid=ptown.srid).get(name='Pueblo')
p2 = City.objects.transform(srid=ptown.srid).get(name='Pueblo')
for p in [p1, p2]:
self.assertEqual(2774, p.point.srid)
- self.assertAlmostEqual(ptown.x, p.point.x, 7)
- self.assertAlmostEqual(ptown.y, p.point.y, 7)
+ self.assertAlmostEqual(ptown.x, p.point.x, prec)
+ self.assertAlmostEqual(ptown.y, p.point.y, prec)
def test09_disjoint(self):
"Testing the `disjoint` lookup type."
diff --git a/django/contrib/gis/tests/test_gdal_geom.py b/django/contrib/gis/tests/test_gdal_geom.py
index 4f16184139..8959d9121f 100644
--- a/django/contrib/gis/tests/test_gdal_geom.py
+++ b/django/contrib/gis/tests/test_gdal_geom.py
@@ -254,8 +254,8 @@ class OGRGeomTest(unittest.TestCase):
def test09b_srs_transform(self):
"Testing transform()."
- orig = OGRGeometry('POINT (-104.609252 38.255001)', 4326)
- trans = OGRGeometry('POINT(992363.390841912 481455.395105533)', 2774)
+ orig = OGRGeometry('POINT (-104.609 38.255)', 4326)
+ trans = OGRGeometry('POINT (992385.4472045 481455.4944650)', 2774)
# Using an srid, a SpatialReference object, and a CoordTransform object
# or transformations.
@@ -266,8 +266,9 @@ class OGRGeomTest(unittest.TestCase):
t3.transform(ct)
for p in (t1, t2, t3):
- self.assertAlmostEqual(trans.x, p.x, 7)
- self.assertAlmostEqual(trans.y, p.y, 7)
+ prec = 3
+ self.assertAlmostEqual(trans.x, p.x, prec)
+ self.assertAlmostEqual(trans.y, p.y, prec)
def test10_difference(self):
"Testing difference()."