Skip to content
Permalink
Browse files

Test that PostGIS query can be passed as both unicode and string literal

  • Loading branch information
strk committed Jul 19, 2017
1 parent 90d4768 commit 9efd666e482c47f8139789fbc702f4a5e91ff178
Showing with 8 additions and 3 deletions.
  1. +8 −3 python/plugins/db_manager/db_plugins/postgis/plugin_test.py
@@ -132,11 +132,16 @@ def test_unicodeInQuery(self):
obj = QObject() # needs to be kept alive
database = PGDatabase(obj, QgsDataSourceUri())
self.assertIsInstance(database, PGDatabase)
sql = "SELECT 'é'::text"
res = database.sqlResultModel(sql, obj)
# SQL as string literal
res = database.sqlResultModel("SELECT 'é'::text", obj)
self.assertIsInstance(res, PGSqlResultModel)
dat = res.getData(0, 0)
self.assertEqual(dat, "é")
self.assertEqual(dat, u"é")
# SQL as unicode literal
res = database.sqlResultModel(u"SELECT 'é'::text", obj)
self.assertIsInstance(res, PGSqlResultModel)
dat = res.getData(0, 0)
self.assertEqual(dat, u"é")


if __name__ == '__main__':

0 comments on commit 9efd666

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