diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-04-03 02:06:01 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-02 17:06:01 -0400 |
| commit | 898e623db0fa6b2cf0b187a3db78b675cde111cf (patch) | |
| tree | 4ffd7179e7dd583b2694139df695d5381a1f0e15 /tests | |
| parent | 35c0025151ad411e691a2fa62a0dd3507ebafd82 (diff) | |
Fixed #27573 -- Made Distance on geodetic coordinates return a raw value on MySQL.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/distapp/tests.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py index 31987d9ce8..aafd5f8035 100644 --- a/tests/gis_tests/distapp/tests.py +++ b/tests/gis_tests/distapp/tests.py @@ -5,7 +5,7 @@ from django.contrib.gis.geos import GEOSGeometry, LineString, Point from django.contrib.gis.measure import D # alias for Distance from django.db import connection from django.db.models import F, Q -from django.test import TestCase, skipUnlessDBFeature +from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from ..utils import no_oracle, oracle, postgis, spatialite from .models import ( @@ -360,6 +360,14 @@ class DistanceFunctionsTests(TestCase): for i, c in enumerate(qs): self.assertAlmostEqual(sphere_distances[i], c.distance.m, tol) + @skipIfDBFeature("supports_distance_geodetic") + @skipUnlessDBFeature("has_Distance_function") + def test_distance_function_raw_result(self): + distance = Interstate.objects.annotate( + d=Distance(Point(0, 0, srid=4326), Point(0, 1, srid=4326)), + ).first().d + self.assertEqual(distance, 1) + @no_oracle # Oracle already handles geographic distance calculation. @skipUnlessDBFeature("has_Distance_function", 'has_Transform_function') def test_distance_transform(self): |
