1
0
mirror of https://github.com/django/django.git synced 2025-10-28 08:06:09 +00:00

Fixed #33783 -- Added IsEmpty GIS database function and __isempty lookup on PostGIS.

This commit is contained in:
Claude Paroz
2022-12-31 15:32:35 +01:00
committed by Mariusz Felisiak
parent 6774e9359c
commit 2a14b8df39
10 changed files with 60 additions and 6 deletions

View File

@@ -371,6 +371,18 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
else:
self.assertIs(c.inter.empty, True)
@skipUnlessDBFeature("supports_empty_geometries", "has_IsEmpty_function")
def test_isempty(self):
empty = City.objects.create(name="Nowhere", point=Point(srid=4326))
City.objects.create(name="Somewhere", point=Point(6.825, 47.1, srid=4326))
self.assertSequenceEqual(
City.objects.annotate(isempty=functions.IsEmpty("point")).filter(
isempty=True
),
[empty],
)
self.assertSequenceEqual(City.objects.filter(point__isempty=True), [empty])
@skipUnlessDBFeature("has_IsValid_function")
def test_isvalid(self):
valid_geom = fromstr("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))")