Skip to content

Commit

Permalink
Followup 19ab72c, add unit test
Browse files Browse the repository at this point in the history
Adds a unit test to ensure that all providers ignore invalid
ids when passed a FilterFids request.

Spoiler: they do
  • Loading branch information
nyalldawson committed Aug 5, 2016
1 parent 1db19ce commit 8773385
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/src/python/providertestbase.py
Expand Up @@ -383,6 +383,11 @@ def testGetFeaturesFidsTests(self):
expected = set([fids[1], fids[3], fids[4]])
assert result == expected, 'Expected {} and got {} when testing for feature IDs filter'.format(expected, result)

#providers should ignore non-existant fids
result = set([f.id() for f in self.provider.getFeatures(QgsFeatureRequest().setFilterFids([-101, fids[1], -102, fids[3], -103, fids[4], -104]))])
expected = set([fids[1], fids[3], fids[4]])
assert result == expected, 'Expected {} and got {} when testing for feature IDs filter'.format(expected, result)

result = set([f.id() for f in self.provider.getFeatures(QgsFeatureRequest().setFilterFids([]))])
expected = set([])
assert result == expected, 'Expected {} and got {} when testing for feature IDs filter'.format(expected, result)
Expand Down

0 comments on commit 8773385

Please sign in to comment.