summaryrefslogtreecommitdiff
path: root/tests/gis_tests/geoapp/test_functions.py
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2020-01-21 21:18:11 +0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-21 22:51:45 +0100
commitd7e4d6463c2fda11214e002ee6b3189f7b882f15 (patch)
treea43c9f2fda4e1c89174f5392803f6dda72f496d5 /tests/gis_tests/geoapp/test_functions.py
parenta062d432a33fe1052cd85eb2902b5472daa4c5f3 (diff)
[3.0.x] Fixed #31195 -- Relaxed GeometryDistance test for PROJ 5.2+.
Backport of 31e2ab345b272b309770262067710589ec433e79 from master
Diffstat (limited to 'tests/gis_tests/geoapp/test_functions.py')
-rw-r--r--tests/gis_tests/geoapp/test_functions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index aa356e30a2..fa59d363f9 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -246,7 +246,7 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
def test_geometry_distance(self):
point = Point(-90, 40, srid=4326)
qs = City.objects.annotate(distance=functions.GeometryDistance('point', point)).order_by('distance')
- self.assertEqual([city.distance for city in qs], [
+ distances = (
2.99091995527296,
5.33507274054713,
9.33852187483721,
@@ -255,7 +255,10 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
14.713098433352,
34.3635252198568,
276.987855073372,
- ])
+ )
+ for city, expected_distance in zip(qs, distances):
+ with self.subTest(city=city):
+ self.assertAlmostEqual(city.distance, expected_distance)
@skipUnlessDBFeature("has_Intersection_function")
def test_intersection(self):