Skip to content

Commit

Permalink
Add a provider test to ensure that features returned from
Browse files Browse the repository at this point in the history
addFeatures have the correct id assigned
  • Loading branch information
nyalldawson committed Oct 25, 2018
1 parent 54c587f commit 89aa19f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/src/python/providertestbase.py
Expand Up @@ -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]),
Expand Down

0 comments on commit 89aa19f

Please sign in to comment.