From: Daniele Varrazzo Date: Tue, 1 Dec 2020 03:04:56 +0000 (+0000) Subject: Added test to check rowcount works after execmany returning tuples X-Git-Tag: 3.0.dev0~295 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73f54a238e723a804ceca4c221819fbce92c9c6e;p=thirdparty%2Fpsycopg.git Added test to check rowcount works after execmany returning tuples --- 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", [