Skip to content

Commit

Permalink
Run string comparison test on all providers
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 31, 2018
1 parent d1eabe1 commit 48bbd24
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/src/python/providertestbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,19 +822,18 @@ def testStringComparison(self):
Test if string comparisons with numbers are cast by the expression
compiler (or work fine without doing anything :P)
"""
vl = self.getEditableLayer()
for expression in (
'5 LIKE \'5\'',
'5 ILIKE \'5\'',
'15 NOT LIKE \'5\'',
'15 NOT ILIKE \'5\'',
'5 ~ \'5\''):
iterator = vl.dataProvider().getFeatures(QgsFeatureRequest().setFilterExpression('5 LIKE \'5\''))
iterator = self.source.getFeatures(QgsFeatureRequest().setFilterExpression('5 LIKE \'5\''))
count = len([f for f in iterator])
self.assertEqual(count, 5)
self.assertFalse(iterator.compileFailed())
self.enableCompiler()
iterator = vl.dataProvider().getFeatures(QgsFeatureRequest().setFilterExpression('5 LIKE \'5\''))
self.assertEqual(count, 5)
self.assertFalse(iterator.compileFailed())
self.disableCompiler()
if self.enableCompiler():
iterator = self.source.getFeatures(QgsFeatureRequest().setFilterExpression('5 LIKE \'5\''))
self.assertEqual(count, 5)
self.assertFalse(iterator.compileFailed())
self.disableCompiler()

0 comments on commit 48bbd24

Please sign in to comment.