Navigation Menu

Skip to content

Commit

Permalink
Tests - Add read WKB from PostGIS St_Binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Oct 5, 2021
1 parent 3263d96 commit 8630bb3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/src/python/test_provider_postgres.py
Expand Up @@ -3275,6 +3275,17 @@ def testUnrestrictedGeometryType(self):
self.assertTrue(lines.isValid())
self.assertTrue(polygons.isValid())

def test_read_wkb(self):
""" Test to read WKB from Postgis. """
md = QgsProviderRegistry.instance().providerMetadata("postgres")
conn = md.createConnection(self.dbconn, {})
results = conn.executeSql("SELECT ST_AsBinary(ST_MakePoint(5, 10));")
wkb = results[0][0]
geom = QgsGeometry()
import binascii
geom.fromWkb(binascii.unhexlify(wkb[2:]))
self.assertEqual(geom.asWkt(), "Point (5 10)")

def testTrustFlag(self):
"""Test regression https://github.com/qgis/QGIS/issues/38809"""

Expand Down

0 comments on commit 8630bb3

Please sign in to comment.