diff options
author | Claude Paroz <claude@2xlibre.net> | 2022-12-31 15:32:35 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-03 05:47:44 +0100 |
commit | 2a14b8df39b573124ea42dec0ce96147c8e767d4 (patch) | |
tree | c18003040c58d555c245ab1fe5e1e3085754eade /tests/gis_tests | |
parent | 6774e9359cbdbf7b8c448597c103288ac381519a (diff) | |
download | django-2a14b8df39b573124ea42dec0ce96147c8e767d4.tar.gz |
Fixed #33783 -- Added IsEmpty GIS database function and __isempty lookup on PostGIS.
Diffstat (limited to 'tests/gis_tests')
-rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index e1a66d573e..535e552aa1 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -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))") |