@@ -96,6 +96,35 @@ def test_BIT(self):
96
96
finally :
97
97
c .execute ("drop table if exists test_BIT" )
98
98
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
+
99
128
def test_bug_2671682 (self ):
100
129
from MySQLdb .constants import ER
101
130
try :
0 commit comments