Skip to content

Commit 670cede

Browse files
committed
Added test for MULTIPOLYGON (that fails in 1742946)
1 parent 1742946 commit 670cede

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_MySQLdb_capabilities.py

+29
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,35 @@ def test_BIT(self):
9696
finally:
9797
c.execute("drop table if exists test_BIT")
9898

99+
def test_MULTIPOLYGON(self):
100+
c = self.cursor
101+
try:
102+
c.execute("""create table test_MULTIPOLYGON (
103+
id INTEGER PRIMARY KEY,
104+
border MULTIPOLYGON)""")
105+
106+
c.execute(
107+
"insert into test_MULTIPOLYGON (id, border)"
108+
" VALUES (1, GeomFromText('MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 3, 1 1)))'))"
109+
)
110+
111+
c.execute("SELECT id, AsText(border) FROM test_MULTIPOLYGON")
112+
row = c.fetchone()
113+
self.assertEqual(row[0], 1)
114+
self.assertEqual(row[1], b'MULTIPOLYGON(((1 1,1 -1,-1 -1,-1 1,1 1)),((1 1,3 1,3 3,1 3,1 1)))')
115+
116+
c.execute("SELECT id, AsWKB(border) FROM test_MULTIPOLYGON")
117+
row = c.fetchone()
118+
self.assertEqual(row[0], 1)
119+
self.assertGreater(len(row[1]), 0)
120+
121+
c.execute("SELECT id, border FROM test_MULTIPOLYGON")
122+
row = c.fetchone()
123+
self.assertEqual(row[0], 1)
124+
self.assertGreater(len(row[1]), 0)
125+
finally:
126+
c.execute("drop table if exists test_MULTIPOLYGON")
127+
99128
def test_bug_2671682(self):
100129
from MySQLdb.constants import ER
101130
try:

0 commit comments

Comments
 (0)