Skip to content
Permalink
Browse files

Run string comparison test on all providers

  • Loading branch information
m-kuhn committed May 31, 2018
1 parent d1eabe1 commit 48bbd2460c793d11f97452759315309100f5e19c
Showing with 6 additions and 7 deletions.
  1. +6 −7 tests/src/python/providertestbase.py
@@ -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.
You can’t perform that action at this time.