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

Refs #35058 -- Added is_3d and set_3d() to OGRGeometry.

This commit is contained in:
David Smith
2024-01-17 06:48:45 +00:00
committed by Mariusz Felisiak
parent 12c71bff83
commit cfacd69ab8
6 changed files with 65 additions and 9 deletions

View File

@@ -714,3 +714,16 @@ class OGRGeomTest(SimpleTestCase, TestDataMixin):
msg = f"Unsupported geometry type: {type_}"
with self.assertRaisesMessage(TypeError, msg):
OGRGeometry(f"{geom_type} EMPTY")
def test_is_3d_and_set_3d(self):
geom = OGRGeometry("POINT (1 2)")
self.assertIs(geom.is_3d, False)
geom.set_3d(True)
self.assertIs(geom.is_3d, True)
self.assertEqual(geom.wkt, "POINT (1 2 0)")
geom.set_3d(False)
self.assertIs(geom.is_3d, False)
self.assertEqual(geom.wkt, "POINT (1 2)")
msg = "Input to 'set_3d' must be a boolean, got 'None'"
with self.assertRaisesMessage(ValueError, msg):
geom.set_3d(None)