Skip to content

Commit 89aa19f

Browse files
committed
Add a provider test to ensure that features returned from
addFeatures have the correct id assigned
1 parent 54c587f commit 89aa19f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/src/python/providertestbase.py

+8
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,14 @@ def testAddFeature(self):
511511
# add empty list, should return true for consistency
512512
self.assertTrue(l.dataProvider().addFeatures([]))
513513

514+
# ensure that returned features have been given the correct id
515+
f = next(l.getFeatures(QgsFeatureRequest().setFilterFid(added[0].id())))
516+
self.assertTrue(f.isValid())
517+
self.assertEqual(f['cnt'], -220)
518+
519+
f = next(l.getFeatures(QgsFeatureRequest().setFilterFid(added[1].id())))
520+
self.assertTrue(f.isValid())
521+
self.assertEqual(f['cnt'], 330)
514522
else:
515523
# expect fail
516524
self.assertFalse(l.dataProvider().addFeatures([f1, f2]),

0 commit comments

Comments
 (0)