Skip to content

Commit ba1bce8

Browse files
committed
Added test for REPLACE RETURNING
1 parent f844622 commit ba1bce8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

testing/test/integration/test_cursor.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,21 +1200,23 @@ def test_conpy194(self):
12001200
rows= cursor.fetchall()
12011201
self.assertEqual(rows, data)
12021202

1203-
cursor.execute("replace t1 set b='bar' returning a")
1203+
cursor.executemany("delete from t1 where a=? returning a", data)
12041204
rows= cursor.fetchall()
1205-
print("***********************************************************")
1206-
print(rows)
1207-
print("***********************************************************")
1205+
self.assertEqual(rows, data)
12081206

1209-
cursor.execute("select * from t1")
1207+
cursor.execute("select a from t1")
12101208
rows= cursor.fetchall()
1211-
print(rows)
1212-
1209+
self.assertEqual(rows, [])
12131210

1214-
cursor.executemany("delete from t1 where a=? returning a", data)
1211+
data= [(1,"foo"),(2,"bar"),(3,"hello")]
1212+
cursor.executemany("insert into t1 values (?,?) returning a,b", data)
12151213
rows= cursor.fetchall()
12161214
self.assertEqual(rows, data)
12171215

1216+
cursor.executemany("replace into t1 values (?,?) returning a,b", [(1, "xyz")])
1217+
rows= cursor.fetchall()
1218+
self.assertEqual(rows, [(1,"xyz")])
1219+
12181220
del cursor, conn
12191221

12201222
def test_conpy91(self):

0 commit comments

Comments
 (0)