Skip to content

Commit

Permalink
Wrong indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Nov 4, 2021
1 parent a04112d commit d378916
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions tests/src/python/test_qgsvectorlayer.py
Expand Up @@ -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):
"""
Expand Down

0 comments on commit d378916

Please sign in to comment.