Skip to content

Commit

Permalink
Fix test under Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 15, 2016
1 parent da74b18 commit 6fefbea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/src/python/test_qgsvectorlayereditbuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def testAddFeatures(self):

# test contents of buffer
added = layer.editBuffer().addedFeatures()
new_feature_ids = added.keys()
new_feature_ids = list(added.keys())
self.assertEqual(added[new_feature_ids[0]]['fldtxt'], 'test2')
self.assertEqual(added[new_feature_ids[0]]['fldint'], 246)
self.assertEqual(added[new_feature_ids[1]]['fldtxt'], 'test')
Expand Down Expand Up @@ -115,7 +115,7 @@ def testAddMultipleFeatures(self):

# test contents of buffer
added = layer.editBuffer().addedFeatures()
new_feature_ids = added.keys()
new_feature_ids = list(added.keys())
self.assertEqual(added[new_feature_ids[0]]['fldtxt'], 'test2')
self.assertEqual(added[new_feature_ids[0]]['fldint'], 246)
self.assertEqual(added[new_feature_ids[1]]['fldtxt'], 'test')
Expand Down Expand Up @@ -161,7 +161,7 @@ def testDeleteFeatures(self):
layer.deleteFeature(2)

# test contents of buffer
self.assertEqual(layer.editBuffer().deletedFeatureIds(), [1, 2])
self.assertEqual(set(layer.editBuffer().deletedFeatureIds()), set([1, 2]))
self.assertTrue(layer.editBuffer().isFeatureDeleted(1))
self.assertTrue(layer.editBuffer().isFeatureDeleted(2))

Expand Down Expand Up @@ -194,7 +194,7 @@ def testDeleteMultipleFeatures(self):
layer.deleteFeatures([1, 2])

# test contents of buffer
self.assertEqual(layer.editBuffer().deletedFeatureIds(), [1, 2])
self.assertEqual(set(layer.editBuffer().deletedFeatureIds()), set([1, 2]))
self.assertTrue(layer.editBuffer().isFeatureDeleted(1))
self.assertTrue(layer.editBuffer().isFeatureDeleted(2))

Expand Down Expand Up @@ -227,7 +227,7 @@ def testChangeAttributeValues(self):
layer.changeAttributeValue(1, 0, 'a')

# test contents of buffer
self.assertEqual(layer.editBuffer().changedAttributeValues().keys(), [1])
self.assertEqual(list(layer.editBuffer().changedAttributeValues().keys()), [1])
self.assertEqual(layer.editBuffer().changedAttributeValues()[1], {0: 'a'})
self.assertTrue(layer.editBuffer().isFeatureAttributesChanged(1))
self.assertFalse(layer.editBuffer().isFeatureAttributesChanged(2))
Expand Down Expand Up @@ -270,7 +270,7 @@ def testChangeGeometry(self):
layer.changeGeometry(1, QgsGeometry.fromPoint(QgsPoint(10, 20)))

# test contents of buffer
self.assertEqual(layer.editBuffer().changedGeometries().keys(), [1])
self.assertEqual(list(layer.editBuffer().changedGeometries().keys()), [1])
self.assertEqual(layer.editBuffer().changedGeometries()[1].geometry().x(), 10)
self.assertTrue(layer.editBuffer().isFeatureGeometryChanged(1))
self.assertFalse(layer.editBuffer().isFeatureGeometryChanged(2))
Expand Down

0 comments on commit 6fefbea

Please sign in to comment.