From 73f54a238e723a804ceca4c221819fbce92c9c6e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 1 Dec 2020 03:04:56 +0000 Subject: [PATCH] Added test to check rowcount works after execmany returning tuples --- tests/test_cursor.py | 9 +++++++++ tests/test_cursor_async.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/test_cursor.py b/tests/test_cursor.py index 45750143e..ba121f9e6 100644 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -180,6 +180,15 @@ def test_executemany_rowcount(conn, execmany): assert cur.rowcount == 2 +def test_executemany_returning_rowcount(conn, execmany): + cur = conn.cursor() + cur.executemany( + "insert into execmany(num, data) values (%s, %s) returning num", + [(10, "hello"), (20, "world")], + ) + assert cur.rowcount == 2 + + @pytest.mark.parametrize( "query", [ diff --git a/tests/test_cursor_async.py b/tests/test_cursor_async.py index 7c3750b61..68052270f 100644 --- a/tests/test_cursor_async.py +++ b/tests/test_cursor_async.py @@ -179,6 +179,15 @@ async def test_executemany_rowcount(aconn, execmany): assert cur.rowcount == 2 +async def test_executemany_returning_rowcount(aconn, execmany): + cur = await aconn.cursor() + await cur.executemany( + "insert into execmany(num, data) values (%s, %s) returning num", + [(10, "hello"), (20, "world")], + ) + assert cur.rowcount == 2 + + @pytest.mark.parametrize( "query", [ -- 2.47.2