From: Daniele Varrazzo Date: Sun, 1 Aug 2021 23:43:25 +0000 (+0200) Subject: Test that the row_cursor param can be set explicitly to none X-Git-Tag: 3.0.dev2~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a84a1285039b5d77a70ce4c04af54c492f5b801d;p=thirdparty%2Fpsycopg.git Test that the row_cursor param can be set explicitly to none --- diff --git a/tests/test_cursor.py b/tests/test_cursor.py index e1faa6a56..c11178987 100644 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -304,6 +304,14 @@ def test_row_factory(conn): assert cur.fetchone() == {"y": "y", "z": "z"} +def test_row_factory_none(conn): + cur = conn.cursor(row_factory=None) + assert cur.row_factory is rows.tuple_row + r = cur.execute("select 1 as a, 2 as b").fetchone() + assert type(r) is tuple + assert r == (1, 2) + + def test_bad_row_factory(conn): def broken_factory(cur): 1 / 0 diff --git a/tests/test_cursor_async.py b/tests/test_cursor_async.py index b29070f02..0c61a2fa5 100644 --- a/tests/test_cursor_async.py +++ b/tests/test_cursor_async.py @@ -310,6 +310,15 @@ async def test_row_factory(aconn): assert await cur.fetchone() == {"y": "y", "z": "z"} +async def test_row_factory_none(aconn): + cur = aconn.cursor(row_factory=None) + assert cur.row_factory is rows.tuple_row + await cur.execute("select 1 as a, 2 as b") + r = await cur.fetchone() + assert type(r) is tuple + assert r == (1, 2) + + async def test_bad_row_factory(aconn): def broken_factory(cur): 1 / 0