Bläddra i källkod

Refs #35058 -- Removed OGRGeometry.coord_dim setter per deprecation timeline.

Sarah Boyce 3 månader sedan
förälder
incheckning
4968f0012e

+ 0 - 12
django/contrib/gis/gdal/geometries.py

@@ -40,7 +40,6 @@
 """
 
 import sys
-import warnings
 from binascii import b2a_hex
 from ctypes import byref, c_char_p, c_double, c_ubyte, c_void_p, string_at
 
@@ -52,7 +51,6 @@ from django.contrib.gis.gdal.prototypes import geom as capi
 from django.contrib.gis.gdal.prototypes import srs as srs_api
 from django.contrib.gis.gdal.srs import CoordTransform, SpatialReference
 from django.contrib.gis.geometry import hex_regex, json_regex, wkt_regex
-from django.utils.deprecation import RemovedInDjango60Warning
 from django.utils.encoding import force_bytes
 
 
@@ -215,16 +213,6 @@ class OGRGeometry(GDALBase):
         "Return the coordinate dimension of the Geometry."
         return capi.get_coord_dim(self.ptr)
 
-    # RemovedInDjango60Warning
-    @coord_dim.setter
-    def coord_dim(self, dim):
-        "Set the coordinate dimension of this Geometry."
-        msg = "coord_dim setter is deprecated. Use set_3d() instead."
-        warnings.warn(msg, RemovedInDjango60Warning, stacklevel=2)
-        if dim not in (2, 3):
-            raise ValueError("Geometry dimension must be either 2 or 3")
-        capi.set_coord_dim(self.ptr, dim)
-
     @property
     def geom_count(self):
         "Return the number of elements in this Geometry."

+ 0 - 9
docs/ref/contrib/gis/gdal.txt

@@ -551,15 +551,6 @@ coordinate transformation:
         >>> polygon.dimension
         2
 
-    .. attribute:: coord_dim
-
-    Returns the coordinate dimension of this geometry. For example, the value
-    would be 2 for two-dimensional geometries.
-
-    .. deprecated:: 5.1
-
-        The ``coord_dim`` setter is deprecated. Use :meth:`.set_3d` instead.
-
     .. attribute:: is_3d
 
     A boolean indicating if this geometry has Z coordinates.

+ 2 - 0
docs/releases/6.0.txt

@@ -312,3 +312,5 @@ to remove usage of these features.
 
 * Support for passing positional arguments to ``Model.save()`` and
   ``Model.asave()`` is removed.
+
+* The setter for ``django.contrib.gis.gdal.OGRGeometry.coord_dim`` is removed.

+ 0 - 11
tests/gis_tests/gdal_tests/test_geom.py

@@ -13,7 +13,6 @@ from django.contrib.gis.geos import GEOSException
 from django.template import Context
 from django.template.engine import Engine
 from django.test import SimpleTestCase
-from django.utils.deprecation import RemovedInDjango60Warning
 
 from ..test_data import TestDataMixin
 
@@ -1063,13 +1062,3 @@ class OGRGeomTest(SimpleTestCase, TestDataMixin):
         )
         self.assertIsInstance(geom, CurvePolygon)
         self.assertIsInstance(geom.shell, CircularString)
-
-
-class DeprecationTests(SimpleTestCase):
-    def test_coord_setter_deprecation(self):
-        geom = OGRGeometry("POINT (1 2)")
-        msg = "coord_dim setter is deprecated. Use set_3d() instead."
-        with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
-            geom.coord_dim = 3
-        self.assertEqual(geom.coord_dim, 3)
-        self.assertEqual(ctx.filename, __file__)