summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Tiainen <jani.tiainen@tintti.net>2015-11-19 12:57:49 +0200
committerTim Graham <timograham@gmail.com>2015-11-19 09:08:14 -0500
commitad0056567b611bad3422af6b99c935b4efce0316 (patch)
treeeb560c4d502c7daa504ac4d4a097e67971edf216
parentcc562c2f567a62ec731776f8a2cd49e9d064280d (diff)
[1.9.x] Fixed #25438 -- Fixed assorted Oracle GIS test failures.
Backport of 58379d7e958fdf024f896b86f7df3415ce876200 from master
-rw-r--r--tests/gis_tests/geoapp/test_functions.py14
-rw-r--r--tests/gis_tests/geogapp/tests.py9
2 files changed, 16 insertions, 7 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index c9e3d1856d..1b6431bbef 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -172,8 +172,8 @@ class GISFunctionsTests(TestCase):
def test_difference(self):
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(diff=functions.Difference('mpoly', geom))
- # For some reason SpatiaLite does something screwy with the Texas geometry here.
- if spatialite:
+ # SpatiaLite and Oracle do something screwy with the Texas geometry.
+ if spatialite or oracle:
qs = qs.exclude(name='Texas')
for c in qs:
@@ -184,8 +184,8 @@ class GISFunctionsTests(TestCase):
"""Testing with mixed SRID (Country has default 4326)."""
geom = Point(556597.4, 2632018.6, srid=3857) # Spherical mercator
qs = Country.objects.annotate(difference=functions.Difference('mpoly', geom))
- # For some reason SpatiaLite does something screwy with the Texas geometry here.
- if spatialite:
+ # SpatiaLite and Oracle do something screwy with the Texas geometry.
+ if spatialite or oracle:
qs = qs.exclude(name='Texas')
for c in qs:
self.assertEqual(c.mpoly.difference(geom), c.difference)
@@ -229,6 +229,9 @@ class GISFunctionsTests(TestCase):
if spatialite:
# When the intersection is empty, Spatialite returns None
expected = None
+ elif oracle:
+ # When the intersection is empty, Oracle returns an empty string
+ expected = ''
else:
expected = c.mpoly.intersection(geom)
self.assertEqual(c.inter, expected)
@@ -385,6 +388,9 @@ class GISFunctionsTests(TestCase):
self.skipTest("GEOS >= 3.3 required")
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(sym_difference=functions.SymDifference('mpoly', geom))
+ # Oracle does something screwy with the Texas geometry.
+ if oracle:
+ qs = qs.exclude(name='Texas')
for country in qs:
# Ordering might differ in collections
self.assertSetEqual(set(g.wkt for g in country.mpoly.sym_difference(geom)),
diff --git a/tests/gis_tests/geogapp/tests.py b/tests/gis_tests/geogapp/tests.py
index a92d6b4e2b..80afbd63c7 100644
--- a/tests/gis_tests/geogapp/tests.py
+++ b/tests/gis_tests/geogapp/tests.py
@@ -98,7 +98,7 @@ 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
+ ref_area = 5439100.13586914 if oracle else 5439084.70637573
tol = 5
z = Zipcode.objects.area().get(code='77002')
self.assertAlmostEqual(z.area.sq_m, ref_area, tol)
@@ -113,7 +113,10 @@ class GeographyFunctionTests(TestCase):
"""
Testing Distance() support on non-point geography fields.
"""
- ref_dists = [0, 4891.20, 8071.64, 9123.95]
+ if oracle:
+ ref_dists = [0, 4899.68, 8081.30, 9115.15]
+ else:
+ ref_dists = [0, 4891.20, 8071.64, 9123.95]
htown = City.objects.get(name='Houston')
qs = Zipcode.objects.annotate(distance=Distance('poly', htown.point))
for z, ref in zip(qs, ref_dists):
@@ -125,7 +128,7 @@ class GeographyFunctionTests(TestCase):
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
+ ref_area = 5439100.13587 if oracle else 5439084.70637573
tol = 5
z = Zipcode.objects.annotate(area=Area('poly')).get(code='77002')
self.assertAlmostEqual(z.area.sq_m, ref_area, tol)