summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabian Schindler <fabian.schindler.strauss@gmail.com>2017-07-10 16:53:29 +0200
committerTim Graham <timograham@gmail.com>2017-08-24 08:30:11 -0400
commitda0fb5b1ec89a747459ab64482f3202cb452c068 (patch)
treed9dd3a5c8f8bef46e7bc3ae9bfaff7ce81b21b2f /tests
parenta8bb49355698a5f7c7d25e06cad2571faa7af9a7 (diff)
Fixed #28380 -- Excluded null geometries in SpatiaLite geometry lookups.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/geoapp/tests.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py
index 18bd42368a..f9838b461b 100644
--- a/tests/gis_tests/geoapp/tests.py
+++ b/tests/gis_tests/geoapp/tests.py
@@ -403,6 +403,27 @@ class GeoLookupTest(TestCase):
State.objects.filter(name='Northern Mariana Islands').update(poly=None)
self.assertIsNone(State.objects.get(name='Northern Mariana Islands').poly)
+ @skipUnlessDBFeature('supports_null_geometries', 'supports_crosses_lookup', 'supports_relate_lookup')
+ def test_null_geometries_excluded_in_lookups(self):
+ """NULL features are excluded in spatial lookup functions."""
+ null = State.objects.create(name='NULL', poly=None)
+ queries = [
+ ('equals', Point(1, 1)),
+ ('disjoint', Point(1, 1)),
+ ('touches', Point(1, 1)),
+ ('crosses', LineString((0, 0), (1, 1), (5, 5))),
+ ('within', Point(1, 1)),
+ ('overlaps', LineString((0, 0), (1, 1), (5, 5))),
+ ('contains', LineString((0, 0), (1, 1), (5, 5))),
+ ('intersects', LineString((0, 0), (1, 1), (5, 5))),
+ ('relate', (Point(1, 1), 'T*T***FF*')),
+ ('same_as', Point(1, 1)),
+ ('exact', Point(1, 1)),
+ ]
+ for lookup, geom in queries:
+ with self.subTest(lookup=lookup):
+ self.assertNotIn(null, State.objects.filter(**{'poly__%s' % lookup: geom}))
+
@skipUnlessDBFeature("supports_relate_lookup")
def test_relate_lookup(self):
"Testing the 'relate' lookup type."