diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-07-26 15:49:20 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-07-27 08:06:08 -0400 |
| commit | 6ebe3a95ea8d436a7f65486d8a6956c7e2175412 (patch) | |
| tree | 0dd2b3cac592c9cf7cb080faecc419e88e9d9c45 /tests | |
| parent | 8e41373c81cbd914d84b362ca4c85d3ed4fcff43 (diff) | |
Fixed #28437 -- Added support for complex geometry expressions in GIS lookups.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/distapp/tests.py | 3 | ||||
| -rw-r--r-- | tests/gis_tests/geoapp/tests.py | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py index ec6c40eac3..395f7226ef 100644 --- a/tests/gis_tests/distapp/tests.py +++ b/tests/gis_tests/distapp/tests.py @@ -73,6 +73,9 @@ class DistanceTest(TestCase): with self.subTest(dist=dist, qs=qs): self.assertEqual(tx_cities, self.get_names(qs)) + # With a complex geometry expression + self.assertFalse(SouthTexasCity.objects.exclude(point__dwithin=(Union('point', 'point'), 0))) + # Now performing the `dwithin` queries on a geodetic coordinate system. for dist in au_dists: with self.subTest(dist=dist): diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py index 1e6d111ba5..18bd42368a 100644 --- a/tests/gis_tests/geoapp/tests.py +++ b/tests/gis_tests/geoapp/tests.py @@ -448,6 +448,18 @@ class GeoLookupTest(TestCase): self.assertEqual('Texas', Country.objects.get(mpoly__relate=(pnt2, intersects_mask)).name) self.assertEqual('Lawrence', City.objects.get(point__relate=(ks.poly, intersects_mask)).name) + # With a complex geometry expression + mask = 'anyinteract' if oracle else within_mask + self.assertFalse(City.objects.exclude(point__relate=(functions.Union('point', 'point'), mask))) + + def test_gis_lookups_with_complex_expressions(self): + multiple_arg_lookups = {'dwithin', 'relate'} # These lookups are tested elsewhere. + lookups = connection.ops.gis_operators.keys() - multiple_arg_lookups + self.assertTrue(lookups, 'No lookups found') + for lookup in lookups: + with self.subTest(lookup): + City.objects.filter(**{'point__' + lookup: functions.Union('point', 'point')}).exists() + class GeoQuerySetTest(TestCase): # TODO: GeoQuerySet is removed, organize these test better. |
