Skip to content
Permalink
Browse files

Followup 19ab72c, add unit test

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 87733851cf9d52945c299d8231a5b8cbaaf1660d
Showing with 5 additions and 0 deletions.
  1. +5 −0 tests/src/python/providertestbase.py
@@ -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)

0 comments on commit 8773385

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