[3.0.x] Fixed #31195 -- Relaxed GeometryDistance test for PROJ 5.2+.

Backport of 31e2ab345b from master
This commit is contained in:
Sergey Fedoseev 2020-01-21 21:18:11 +05:00 committed by Mariusz Felisiak
parent a062d432a3
commit d7e4d6463c
1 changed files with 5 additions and 2 deletions

View File

@ -246,7 +246,7 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
def test_geometry_distance(self): def test_geometry_distance(self):
point = Point(-90, 40, srid=4326) point = Point(-90, 40, srid=4326)
qs = City.objects.annotate(distance=functions.GeometryDistance('point', point)).order_by('distance') qs = City.objects.annotate(distance=functions.GeometryDistance('point', point)).order_by('distance')
self.assertEqual([city.distance for city in qs], [ distances = (
2.99091995527296, 2.99091995527296,
5.33507274054713, 5.33507274054713,
9.33852187483721, 9.33852187483721,
@ -255,7 +255,10 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
14.713098433352, 14.713098433352,
34.3635252198568, 34.3635252198568,
276.987855073372, 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") @skipUnlessDBFeature("has_Intersection_function")
def test_intersection(self): def test_intersection(self):