Skip to content

Commit 2a572be

Browse files
committedJul 19, 2017
Add test for #16833
Tested to pass with Python 2.7.13
1 parent ff0df6d commit 2a572be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎python/plugins/db_manager/db_plugins/postgis/plugin_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
from db_manager.db_plugins.postgis.plugin import PostGisDBPlugin, PGRasterTable
3737
from db_manager.db_plugins.postgis.plugin import PGDatabase
38+
from db_manager.db_plugins.postgis.data_model import PGSqlResultModel
3839
from db_manager.db_plugins.plugin import Table
3940
from db_manager.db_plugins.postgis.connector import PostGisDBConnector
4041

@@ -125,6 +126,18 @@ def check_rasterTableGdalURI(expected_dbname):
125126

126127
check_rasterTableGdalURI(expected_dbname)
127128

129+
# See http://issues.qgis.org/issues/16833
130+
def test_unicodeInQuery(self):
131+
os.environ['PGDATABASE'] = self.testdb
132+
obj = QObject() # needs to be kept alive
133+
database = PGDatabase(obj, QgsDataSourceUri())
134+
self.assertIsInstance(database, PGDatabase)
135+
sql = "SELECT 'é'::text"
136+
res = database.sqlResultModel(sql, obj)
137+
self.assertIsInstance(res, PGSqlResultModel)
138+
dat = res.getData(0, 0)
139+
self.assertEqual(dat, "é")
140+
128141

129142
if __name__ == '__main__':
130143
unittest.main()

0 commit comments

Comments
 (0)
Please sign in to comment.