Skip to content
Browse files

Add tests

  • Loading branch information
nirvn committed May 6, 2019
1 parent eacc506 commit 7376e6f82c1105460f856a17acdc4ea20f14e887
Showing with 24 additions and 0 deletions.
  1. +14 −0 tests/src/python/
  2. +10 −0 tests/src/python/
@@ -109,6 +109,20 @@ def testConnect(self):
self.assertFalse(connection_succeeded, 'exception should have been raised')

def testExecuteRegExp(self):
"""This test checks for REGEXP syntax support, which is enabled in Qgis.utils' spatialite_connection()"""

connection_name = 'testListLayer'
plugin = createDbPlugin('spatialite')
uri = QgsDataSourceUri()
self.assertTrue(plugin.addConnection(connection_name, uri))

connection = createDbPlugin('spatialite', connection_name)
db = connection.database()
db.connector._execute(None, 'SELECT \'ABC\' REGEXP \'[CBA]\'')

def testListLayer(self):
connection_name = 'testListLayer'
plugin = createDbPlugin('spatialite')
@@ -701,6 +701,16 @@ def testCreateAttributeIndex(self):
self.assertEqual(set(indexed_columns), set(['name', 'number']))

def testSubsetStringRegexp(self):
"""Check that the provider supports the REGEXP syntax"""

testPath = "dbname=%s table='test_filter' (geometry) key='id'" % self.dbname
vl = QgsVectorLayer(testPath, 'test', 'spatialite')
vl.setSubsetString('"name" REGEXP \'[txe]\'')
self.assertEqual(vl.featureCount(), 4)

def testSubsetStringExtent_bug17863(self):
"""Check that the extent is correct when applied in the ctor and when
modified after a subset string is set """

0 comments on commit 7376e6f

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