Skip to content
Permalink
Browse files

Fix test failure on GDAL >= 2.0

  • Loading branch information
nyalldawson committed Apr 14, 2016
1 parent 0672abb commit 83036886b70636c463e9fcf852fe89d92d84c35a
Showing with 41 additions and 40 deletions.
  1. +41 −38 tests/src/python/test_provider_shapefile.py
  2. +0 −2 tests/src/python/test_qgsvectorfilewriter.py
@@ -18,6 +18,7 @@
import tempfile
import shutil
import glob
import osgeo.gdal

from qgis.core import QgsVectorLayer, QgsFeatureRequest
from PyQt.QtCore import QSettings
@@ -67,44 +68,46 @@ def disableCompiler(self):
QSettings().setValue(u'/qgis/compileExpressions', False)

def uncompiledFilters(self):
return set(['name ILIKE \'QGIS\'',
'"name" NOT LIKE \'Ap%\'',
'"name" NOT ILIKE \'QGIS\'',
'"name" NOT ILIKE \'pEAR\'',
'name <> \'Apple\'',
'"name" <> \'apple\'',
'(name = \'Apple\') is not null',
'name ILIKE \'aPple\'',
'name ILIKE \'%pp%\'',
'cnt = 1100 % 1000',
'"name" || \' \' || "name" = \'Orange Orange\'',
'"name" || \' \' || "cnt" = \'Orange 100\'',
'\'x\' || "name" IS NOT NULL',
'\'x\' || "name" IS NULL',
'cnt = 10 ^ 2',
'"name" ~ \'[OP]ra[gne]+\'',
'false and NULL',
'true and NULL',
'NULL and false',
'NULL and true',
'NULL and NULL',
'false or NULL',
'true or NULL',
'NULL or false',
'NULL or true',
'NULL or NULL',
'not null',
'not name = \'Apple\'',
'not name = \'Apple\' or name = \'Apple\'',
'not name = \'Apple\' or not name = \'Apple\'',
'not name = \'Apple\' and pk = 4',
'not name = \'Apple\' and not pk = 4',
'num_char IN (2, 4, 5)',
'-cnt > 0',
'-cnt < 0',
'-cnt - 1 = -101',
'-(-cnt) = 100',
'-(cnt) = -(100)'])
filters = set(['name ILIKE \'QGIS\'',
'"name" NOT LIKE \'Ap%\'',
'"name" NOT ILIKE \'QGIS\'',
'"name" NOT ILIKE \'pEAR\'',
'name <> \'Apple\'',
'"name" <> \'apple\'',
'(name = \'Apple\') is not null',
'name ILIKE \'aPple\'',
'name ILIKE \'%pp%\'',
'cnt = 1100 % 1000',
'"name" || \' \' || "name" = \'Orange Orange\'',
'"name" || \' \' || "cnt" = \'Orange 100\'',
'\'x\' || "name" IS NOT NULL',
'\'x\' || "name" IS NULL',
'cnt = 10 ^ 2',
'"name" ~ \'[OP]ra[gne]+\'',
'false and NULL',
'true and NULL',
'NULL and false',
'NULL and true',
'NULL and NULL',
'false or NULL',
'true or NULL',
'NULL or false',
'NULL or true',
'NULL or NULL',
'not name = \'Apple\'',
'not name = \'Apple\' or name = \'Apple\'',
'not name = \'Apple\' or not name = \'Apple\'',
'not name = \'Apple\' and pk = 4',
'not name = \'Apple\' and not pk = 4',
'num_char IN (2, 4, 5)',
'-cnt > 0',
'-cnt < 0',
'-cnt - 1 = -101',
'-(-cnt) = 100',
'-(cnt) = -(100)'])
if int(osgeo.gdal.VersionInfo()[:1]) < 2:
filters.insert('not null')
return filters

def partiallyCompiledFilters(self):
return set(['name = \'Apple\'',
@@ -164,8 +164,6 @@ def testDateTimeWriteTabfile(self):
assert isinstance(f.attributes()[datetime_idx], QDateTime)
self.assertEqual(f.attributes()[datetime_idx], QDateTime(QDate(2014, 3, 5), QTime(13, 45, 22)))

# This test fails with GDAL version < 2
@unittest.expectedFailure(osgeo.gdal.VersionInfo()[:1] < 2)
def testWriteShapefileWithZ(self):
"""Check writing geometries with Z dimension to an ESRI shapefile."""

0 comments on commit 8303688

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