Skip to content
Permalink
Browse files

Add a provider test to ensure that features returned from

addFeatures have the correct id assigned
  • Loading branch information
nyalldawson committed Oct 22, 2018
1 parent 54c587f commit 89aa19f643200c9829e7ebd70b7d2e06b8c23735
Showing with 8 additions and 0 deletions.
  1. +8 −0 tests/src/python/providertestbase.py
@@ -511,6 +511,14 @@ def testAddFeature(self):
# add empty list, should return true for consistency
self.assertTrue(l.dataProvider().addFeatures([]))

# ensure that returned features have been given the correct id
f = next(l.getFeatures(QgsFeatureRequest().setFilterFid(added[0].id())))
self.assertTrue(f.isValid())
self.assertEqual(f['cnt'], -220)

f = next(l.getFeatures(QgsFeatureRequest().setFilterFid(added[1].id())))
self.assertTrue(f.isValid())
self.assertEqual(f['cnt'], 330)
else:
# expect fail
self.assertFalse(l.dataProvider().addFeatures([f1, f2]),

0 comments on commit 89aa19f

Please sign in to comment.
You can’t perform that action at this time.