Skip to content
Permalink
Browse files
Wrong indentation
  • Loading branch information
elpaso authored and nyalldawson committed Nov 4, 2021
1 parent a04112d commit d3789167eb4f559366fe26d418b6ab095bd4cec0
Showing with 25 additions and 25 deletions.
  1. +25 −25 tests/src/python/test_qgsvectorlayer.py
@@ -3660,31 +3660,31 @@ def onFeaturesDeleted(deleted_fids):
self.assertEqual(layer.featureCount(), 0)
self.assertEqual(layer.selectedFeatureIds(), [])

def testCommitChangesReportsDeletedFeatureIDs(self):
"""
Tests if commitChanges emits "featuresDeleted" with all deleted feature IDs,
e.g. in case (negative) temporary FIDs are converted into (positive) persistent FIDs.
"""
temp_fids = []

def onFeaturesDeleted(deleted_fids):
self.assertEqual(len(deleted_fids), len(temp_fids),
msg=f'featuresDeleted returned {len(deleted_fids)} instead of 2 deleted feature IDs: '
f'{deleted_fids}')
for d in deleted_fids:
self.assertTrue(d in temp_fids)

layer = QgsVectorLayer("point?crs=epsg:4326&field=name:string", "Scratch point layer", "memory")
layer.featuresDeleted.connect(onFeaturesDeleted)

layer.startEditing()
layer.beginEditCommand('add 2 features')
layer.addFeature(QgsFeature(layer.fields()))
layer.addFeature(QgsFeature(layer.fields()))
layer.endEditCommand()
temp_fids.extend(layer.allFeatureIds())

layer.commitChanges()
def testCommitChangesReportsDeletedFeatureIDs(self):
"""
Tests if commitChanges emits "featuresDeleted" with all deleted feature IDs,
e.g. in case (negative) temporary FIDs are converted into (positive) persistent FIDs.
"""
temp_fids = []

def onFeaturesDeleted(deleted_fids):
self.assertEqual(len(deleted_fids), len(temp_fids),
msg=f'featuresDeleted returned {len(deleted_fids)} instead of 2 deleted feature IDs: '
f'{deleted_fids}')
for d in deleted_fids:
self.assertTrue(d in temp_fids)

layer = QgsVectorLayer("point?crs=epsg:4326&field=name:string", "Scratch point layer", "memory")
layer.featuresDeleted.connect(onFeaturesDeleted)

layer.startEditing()
layer.beginEditCommand('add 2 features')
layer.addFeature(QgsFeature(layer.fields()))
layer.addFeature(QgsFeature(layer.fields()))
layer.endEditCommand()
temp_fids.extend(layer.allFeatureIds())

layer.commitChanges()

def testSubsetStringInvalidLayer(self):
"""

0 comments on commit d378916

Please sign in to comment.