mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Add tests
This commit is contained in:
parent
eacc506a5a
commit
7376e6f82c
@ -109,6 +109,20 @@ class TestPyQgsDBManagerSpatialite(unittest.TestCase):
|
||||
pass
|
||||
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()
|
||||
uri.setDatabase(self.test_spatialite)
|
||||
self.assertTrue(plugin.addConnection(connection_name, uri))
|
||||
|
||||
connection = createDbPlugin('spatialite', connection_name)
|
||||
connection.connect()
|
||||
db = connection.database()
|
||||
db.connector._execute(None, 'SELECT \'ABC\' REGEXP \'[CBA]\'')
|
||||
|
||||
def testListLayer(self):
|
||||
connection_name = 'testListLayer'
|
||||
plugin = createDbPlugin('spatialite')
|
||||
|
@ -701,6 +701,16 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase):
|
||||
self.assertEqual(set(indexed_columns), set(['name', 'number']))
|
||||
con.close()
|
||||
|
||||
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')
|
||||
self.assertTrue(vl.isValid())
|
||||
vl.setSubsetString('"name" REGEXP \'[txe]\'')
|
||||
self.assertEqual(vl.featureCount(), 4)
|
||||
del(vl)
|
||||
|
||||
def testSubsetStringExtent_bug17863(self):
|
||||
"""Check that the extent is correct when applied in the ctor and when
|
||||
modified after a subset string is set """
|
||||
|
Loading…
x
Reference in New Issue
Block a user