diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-07-24 23:19:28 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-07-25 15:49:35 -0400 |
| commit | 38af496b98a82816072d5f0932c1eb886d0197b3 (patch) | |
| tree | b2c9ec59c696a2fb487559144f9045cc99c7b352 /tests | |
| parent | c7d58c6f43b2d1db5d01f32451bb9ce46d69c5eb (diff) | |
Fixed #28432 -- Allowed geometry expressions to be used with distance lookups.
Distance lookups use the Distance function for decreased code redundancy.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/distapp/tests.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py index 8b8fb90c8c..c4003e14f3 100644 --- a/tests/gis_tests/distapp/tests.py +++ b/tests/gis_tests/distapp/tests.py @@ -1,5 +1,5 @@ from django.contrib.gis.db.models.functions import ( - Area, Distance, Length, Perimeter, Transform, + Area, Distance, Intersection, Length, Perimeter, Transform, ) from django.contrib.gis.geos import GEOSGeometry, LineString, Point from django.contrib.gis.measure import D # alias for Distance @@ -206,6 +206,13 @@ class DistanceTest(TestCase): ).order_by('name') self.assertEqual(self.get_names(qs), ['Canberra', 'Hobart', 'Melbourne']) + # With a complex geometry expression + self.assertFalse(SouthTexasCity.objects.filter(point__distance_gt=(Intersection('point', 'point'), 0))) + self.assertEqual( + SouthTexasCity.objects.filter(point__distance_lte=(Intersection('point', 'point'), 0)).count(), + SouthTexasCity.objects.count(), + ) + ''' ============================= |
