summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2016-11-30 18:49:05 +0600
committerTim Graham <timograham@gmail.com>2016-11-30 07:49:05 -0500
commitf24eea3b69d9c3139f0145cd48a8962f67671aff (patch)
treed802f0c84c195d9cc6ce3228aa9025f666f9c720
parent21322f92710a447708409f1fce52ee9d18752eaf (diff)
Simplified union GIS tests with equals() rather than equals_exact().
-rw-r--r--tests/gis_tests/geoapp/test_functions.py7
-rw-r--r--tests/gis_tests/geoapp/tests.py8
2 files changed, 5 insertions, 10 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index 3d809927b9..a2c172b001 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -485,8 +485,5 @@ class GISFunctionsTests(TestCase):
def test_union(self):
geom = Point(-95.363151, 29.763374, srid=4326)
ptown = City.objects.annotate(union=functions.Union('point', geom)).get(name='Dallas')
- tol = 0.00001
- # Undefined ordering
- expected1 = fromstr('MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)', srid=4326)
- expected2 = fromstr('MULTIPOINT(-95.363151 29.763374,-96.801611 32.782057)', srid=4326)
- self.assertTrue(expected1.equals_exact(ptown.union, tol) or expected2.equals_exact(ptown.union, tol))
+ expected = fromstr('MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)', srid=4326)
+ self.assertTrue(expected.equals(ptown.union))
diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py
index 536aa1b907..074162fe14 100644
--- a/tests/gis_tests/geoapp/tests.py
+++ b/tests/gis_tests/geoapp/tests.py
@@ -858,8 +858,7 @@ class GeoQuerySetTest(TestCase):
"""
tx = Country.objects.get(name='Texas').mpoly
# Houston, Dallas -- Ordering may differ depending on backend or GEOS version.
- union1 = fromstr('MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)')
- union2 = fromstr('MULTIPOINT(-95.363151 29.763374,-96.801611 32.782057)')
+ union = GEOSGeometry('MULTIPOINT(-96.801611 32.782057,-95.363151 29.763374)')
qs = City.objects.filter(point__within=tx)
with self.assertRaises(ValueError):
qs.aggregate(Union('name'))
@@ -868,9 +867,8 @@ class GeoQuerySetTest(TestCase):
# an aggregate method on a spatial column)
u1 = qs.aggregate(Union('point'))['point__union']
u2 = qs.order_by('name').aggregate(Union('point'))['point__union']
- tol = 0.00001
- self.assertTrue(union1.equals_exact(u1, tol) or union2.equals_exact(u1, tol))
- self.assertTrue(union1.equals_exact(u2, tol) or union2.equals_exact(u2, tol))
+ self.assertTrue(union.equals(u1))
+ self.assertTrue(union.equals(u2))
qs = City.objects.filter(name='NotACity')
self.assertIsNone(qs.aggregate(Union('point'))['point__union'])