Skip to content

Commit

Permalink
Fix invalid tests -- illegal modification of const reference to geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 15, 2021
1 parent 87452aa commit be12051
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/src/python/test_qgsgeometry.py
Expand Up @@ -2858,7 +2858,7 @@ def testAddZValue(self):

# circular string
geom = QgsGeometry.fromWkt('CircularString (1 5, 6 2, 7 3)')
assert geom.constGet().addZValue(2)
assert geom.get().addZValue(2)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.CircularStringZ)
expWkt = 'CircularStringZ (1 5 2, 6 2 2, 7 3 2)'
wkt = geom.asWkt()
Expand All @@ -2868,7 +2868,7 @@ def testAddZValue(self):
# compound curve
geom = QgsGeometry.fromWkt(
'CompoundCurve ((5 3, 5 13),CircularString (5 13, 7 15, 9 13),(9 13, 9 3),CircularString (9 3, 7 1, 5 3))')
assert geom.constGet().addZValue(2)
assert geom.get().addZValue(2)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.CompoundCurveZ)
expWkt = 'CompoundCurveZ ((5 3 2, 5 13 2),CircularStringZ (5 13 2, 7 15 2, 9 13 2),(9 13 2, 9 3 2),CircularStringZ (9 3 2, 7 1 2, 5 3 2))'
wkt = geom.asWkt()
Expand All @@ -2877,7 +2877,7 @@ def testAddZValue(self):

# curve polygon
geom = QgsGeometry.fromWkt('Polygon ((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))')
assert geom.constGet().addZValue(3)
assert geom.get().addZValue(3)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.PolygonZ)
self.assertEqual(geom.wkbType(), QgsWkbTypes.PolygonZ)
expWkt = 'PolygonZ ((0 0 3, 1 0 3, 1 1 3, 2 1 3, 2 2 3, 0 2 3, 0 0 3))'
Expand All @@ -2887,7 +2887,7 @@ def testAddZValue(self):

# geometry collection
geom = QgsGeometry.fromWkt('MultiPoint ((1 2),(2 3))')
assert geom.constGet().addZValue(4)
assert geom.get().addZValue(4)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.MultiPointZ)
self.assertEqual(geom.wkbType(), QgsWkbTypes.MultiPointZ)
expWkt = 'MultiPointZ ((1 2 4),(2 3 4))'
Expand All @@ -2897,7 +2897,7 @@ def testAddZValue(self):

# LineString
geom = QgsGeometry.fromWkt('LineString (1 2, 2 3)')
assert geom.constGet().addZValue(4)
assert geom.get().addZValue(4)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.LineStringZ)
self.assertEqual(geom.wkbType(), QgsWkbTypes.LineStringZ)
expWkt = 'LineStringZ (1 2 4, 2 3 4)'
Expand All @@ -2907,7 +2907,7 @@ def testAddZValue(self):

# Point
geom = QgsGeometry.fromWkt('Point (1 2)')
assert geom.constGet().addZValue(4)
assert geom.get().addZValue(4)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.PointZ)
self.assertEqual(geom.wkbType(), QgsWkbTypes.PointZ)
expWkt = 'PointZ (1 2 4)'
Expand All @@ -2919,7 +2919,7 @@ def testAddMValue(self):

# circular string
geom = QgsGeometry.fromWkt('CircularString (1 5, 6 2, 7 3)')
assert geom.constGet().addMValue(2)
assert geom.get().addMValue(2)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.CircularStringM)
expWkt = 'CircularStringM (1 5 2, 6 2 2, 7 3 2)'
wkt = geom.asWkt()
Expand All @@ -2929,7 +2929,7 @@ def testAddMValue(self):
# compound curve
geom = QgsGeometry.fromWkt(
'CompoundCurve ((5 3, 5 13),CircularString (5 13, 7 15, 9 13),(9 13, 9 3),CircularString (9 3, 7 1, 5 3))')
assert geom.constGet().addMValue(2)
assert geom.get().addMValue(2)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.CompoundCurveM)
expWkt = 'CompoundCurveM ((5 3 2, 5 13 2),CircularStringM (5 13 2, 7 15 2, 9 13 2),(9 13 2, 9 3 2),CircularStringM (9 3 2, 7 1 2, 5 3 2))'
wkt = geom.asWkt()
Expand All @@ -2938,7 +2938,7 @@ def testAddMValue(self):

# curve polygon
geom = QgsGeometry.fromWkt('Polygon ((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))')
assert geom.constGet().addMValue(3)
assert geom.get().addMValue(3)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.PolygonM)
expWkt = 'PolygonM ((0 0 3, 1 0 3, 1 1 3, 2 1 3, 2 2 3, 0 2 3, 0 0 3))'
wkt = geom.asWkt()
Expand All @@ -2947,7 +2947,7 @@ def testAddMValue(self):

# geometry collection
geom = QgsGeometry.fromWkt('MultiPoint ((1 2),(2 3))')
assert geom.constGet().addMValue(4)
assert geom.get().addMValue(4)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.MultiPointM)
expWkt = 'MultiPointM ((1 2 4),(2 3 4))'
wkt = geom.asWkt()
Expand All @@ -2956,7 +2956,7 @@ def testAddMValue(self):

# LineString
geom = QgsGeometry.fromWkt('LineString (1 2, 2 3)')
assert geom.constGet().addMValue(4)
assert geom.get().addMValue(4)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.LineStringM)
expWkt = 'LineStringM (1 2 4, 2 3 4)'
wkt = geom.asWkt()
Expand All @@ -2965,7 +2965,7 @@ def testAddMValue(self):

# Point
geom = QgsGeometry.fromWkt('Point (1 2)')
assert geom.constGet().addMValue(4)
assert geom.get().addMValue(4)
self.assertEqual(geom.constGet().wkbType(), QgsWkbTypes.PointM)
expWkt = 'PointM (1 2 4)'
wkt = geom.asWkt()
Expand Down

0 comments on commit be12051

Please sign in to comment.