summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-01-28 07:44:55 -0500
committerTim Graham <timograham@gmail.com>2016-01-28 17:45:34 -0500
commit99cd139a30329ff3b8f0d1346c8fd4770cbd7141 (patch)
tree4d4e0bcf9579d96840d7ff7a138f24571dd7cd4e /tests
parenta0e0b37dae9a03468177bea45e97eed74c78eb13 (diff)
[1.8.x] Fixed #26147 -- Relaxed expected values in GIS tests to account for database/library differences.
Backport of 5aa53286758fbb1fb864a5efda38718a2ca96759 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/distapp/tests.py2
-rw-r--r--tests/gis_tests/geogapp/tests.py10
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py
index bde78a8e06..a047980c9c 100644
--- a/tests/gis_tests/distapp/tests.py
+++ b/tests/gis_tests/distapp/tests.py
@@ -142,7 +142,7 @@ class DistanceTest(TestCase):
"""
Test the `distance` GeoQuerySet method on geodetic coordinate systems.
"""
- tol = 2 if oracle else 5
+ tol = 2 if oracle else 4
# Testing geodetic distance calculation with a non-point geometry
# (a LineString of Wollongong and Shellharbour coords).
diff --git a/tests/gis_tests/geogapp/tests.py b/tests/gis_tests/geogapp/tests.py
index e3e97f47cd..e2f7dc20e1 100644
--- a/tests/gis_tests/geogapp/tests.py
+++ b/tests/gis_tests/geogapp/tests.py
@@ -12,7 +12,7 @@ from django.contrib.gis.measure import D
from django.test import TestCase, skipUnlessDBFeature
from django.utils._os import upath
-from ..utils import oracle, postgis
+from ..utils import postgis
if HAS_GEOS:
from .models import City, County, Zipcode
@@ -97,7 +97,9 @@ class GeographyTest(TestCase):
def test06_geography_area(self):
"Testing that Area calculations work on geography columns."
# SELECT ST_Area(poly) FROM geogapp_zipcode WHERE code='77002';
- ref_area = 5439100.95415646 if oracle else 5439084.70637573
- tol = 5
z = Zipcode.objects.area().get(code='77002')
- self.assertAlmostEqual(z.area.sq_m, ref_area, tol)
+ # Round to the nearest thousand as possible values (depending on
+ # the database and geolib) include 5439084, 5439100, 5439101.
+ rounded_value = z.area.sq_m
+ rounded_value -= z.area.sq_m % 1000
+ self.assertEqual(rounded_value, 5439000)