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()."