@@ -500,13 +500,20 @@ def test_wrap_exc(self):
500500 assert 'You have an error in your SQL syntax' in exc .errmsg , exc .errmsg
501501
502502 def test_extended_types (self ):
503+ import uuid
504+
505+ key = str (uuid .uuid4 ())
506+
503507 # shapely data
504508 data = [
505- (1 , 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))' , 'POINT(1.5 1.5)' , [0.5 , 0.6 ]),
506- (2 , 'POLYGON((5 1, 6 1, 6 2, 5 2, 5 1))' , 'POINT(5.5 1.5)' , [1.3 , 2.5 ]),
507- (3 , 'POLYGON((5 5, 6 5, 6 6, 5 6, 5 5))' , 'POINT(5.5 5.5)' , [10.3 , 11.1 ]),
508- (4 , 'POLYGON((1 5, 2 5, 2 6, 1 6, 1 5))' , 'POINT(1.5 5.5)' , [3.3 , 3.4 ]),
509- (5 , 'POLYGON((3 3, 4 3, 4 4, 3 4, 3 3))' , 'POINT(3.5 3.5)' , [2.9 , 9.5 ]),
509+ (1 , 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))' , 'POINT(1.5 1.5)' , [0.5 , 0.6 ], key ),
510+ (2 , 'POLYGON((5 1, 6 1, 6 2, 5 2, 5 1))' , 'POINT(5.5 1.5)' , [1.3 , 2.5 ], key ),
511+ (
512+ 3 , 'POLYGON((5 5, 6 5, 6 6, 5 6, 5 5))' ,
513+ 'POINT(5.5 5.5)' , [10.3 , 11.1 ], key ,
514+ ),
515+ (4 , 'POLYGON((1 5, 2 5, 2 6, 1 6, 1 5))' , 'POINT(1.5 5.5)' , [3.3 , 3.4 ], key ),
516+ (5 , 'POLYGON((3 3, 4 3, 4 4, 3 4, 3 3))' , 'POINT(3.5 3.5)' , [2.9 , 9.5 ], key ),
510517 ]
511518
512519 new_data = []
@@ -521,11 +528,14 @@ def test_extended_types(self):
521528 new_data .append (row )
522529
523530 self .cur .executemany (
524- 'INSERT INTO extended_types (id, geography, geographypoint, vectors) '
525- 'VALUES (%s, %s, %s, %s)' , new_data ,
531+ 'INSERT INTO extended_types '
532+ '(id, geography, geographypoint, vectors, testkey) '
533+ 'VALUES (%s, %s, %s, %s, %s)' , new_data ,
526534 )
527535
528- self .cur .execute ('SELECT * FROM extended_types ORDER BY id' )
536+ self .cur .execute (
537+ 'SELECT * FROM extended_types WHERE testkey = %s ORDER BY id' , [key ],
538+ )
529539
530540 for data_row , row in zip (new_data , self .cur ):
531541 assert data_row [0 ] == row [0 ]
@@ -538,11 +548,14 @@ def test_extended_types(self):
538548
539549 # pygeos data
540550 data = [
541- (6 , 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))' , 'POINT(1.5 1.5)' , [0.5 , 0.6 ]),
542- (7 , 'POLYGON((5 1, 6 1, 6 2, 5 2, 5 1))' , 'POINT(5.5 1.5)' , [1.3 , 2.5 ]),
543- (8 , 'POLYGON((5 5, 6 5, 6 6, 5 6, 5 5))' , 'POINT(5.5 5.5)' , [10.3 , 11.1 ]),
544- (9 , 'POLYGON((1 5, 2 5, 2 6, 1 6, 1 5))' , 'POINT(1.5 5.5)' , [3.3 , 3.4 ]),
545- (10 , 'POLYGON((3 3, 4 3, 4 4, 3 4, 3 3))' , 'POINT(3.5 3.5)' , [2.9 , 9.5 ]),
551+ (6 , 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))' , 'POINT(1.5 1.5)' , [0.5 , 0.6 ], key ),
552+ (7 , 'POLYGON((5 1, 6 1, 6 2, 5 2, 5 1))' , 'POINT(5.5 1.5)' , [1.3 , 2.5 ], key ),
553+ (
554+ 8 , 'POLYGON((5 5, 6 5, 6 6, 5 6, 5 5))' ,
555+ 'POINT(5.5 5.5)' , [10.3 , 11.1 ], key ,
556+ ),
557+ (9 , 'POLYGON((1 5, 2 5, 2 6, 1 6, 1 5))' , 'POINT(1.5 5.5)' , [3.3 , 3.4 ], key ),
558+ (10 , 'POLYGON((3 3, 4 3, 4 4, 3 4, 3 3))' , 'POINT(3.5 3.5)' , [2.9 , 9.5 ], key ),
546559 ]
547560
548561 new_data = []
@@ -557,11 +570,16 @@ def test_extended_types(self):
557570 new_data .append (row )
558571
559572 self .cur .executemany (
560- 'INSERT INTO extended_types (id, geography, geographypoint, vectors) '
561- 'VALUES (%s, %s, %s, %s)' , new_data ,
573+ 'INSERT INTO extended_types '
574+ '(id, geography, geographypoint, vectors, testkey) '
575+ 'VALUES (%s, %s, %s, %s, %s)' , new_data ,
562576 )
563577
564- self .cur .execute ('SELECT * FROM extended_types WHERE id >= 6 ORDER BY id' )
578+ self .cur .execute (
579+ 'SELECT * FROM extended_types WHERE id >= 6 and testkey = %s ORDER BY id' , [
580+ key ,
581+ ],
582+ )
565583
566584 for data_row , row in zip (new_data , self .cur ):
567585 assert data_row [0 ] == row [0 ]
0 commit comments