Navigation Menu

Skip to content

Commit

Permalink
Added test for REPLACE RETURNING
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Feb 20, 2022
1 parent f844622 commit ba1bce8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions testing/test/integration/test_cursor.py
Expand Up @@ -1200,21 +1200,23 @@ def test_conpy194(self):
rows= cursor.fetchall()
self.assertEqual(rows, data)

cursor.execute("replace t1 set b='bar' returning a")
cursor.executemany("delete from t1 where a=? returning a", data)
rows= cursor.fetchall()
print("***********************************************************")
print(rows)
print("***********************************************************")
self.assertEqual(rows, data)

cursor.execute("select * from t1")
cursor.execute("select a from t1")
rows= cursor.fetchall()
print(rows)

self.assertEqual(rows, [])

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

cursor.executemany("replace into t1 values (?,?) returning a,b", [(1, "xyz")])
rows= cursor.fetchall()
self.assertEqual(rows, [(1,"xyz")])

del cursor, conn

def test_conpy91(self):
Expand Down

0 comments on commit ba1bce8

Please sign in to comment.