From fa81751e1cfa9876faaa16b8a1c907c254a4cce1 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 24 Feb 2021 19:22:50 +0100 Subject: [PATCH] Add tuple_row test --- tests/test_rows.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_rows.py b/tests/test_rows.py index d2f9d97d7..836db33d8 100644 --- a/tests/test_rows.py +++ b/tests/test_rows.py @@ -1,6 +1,16 @@ from psycopg3 import rows +def test_tuple_row(conn): + conn.row_factory = rows.dict_row + assert conn.execute("select 1 as a").fetchone() == {"a": 1} + cur = conn.cursor(row_factory=rows.tuple_row) + row = cur.execute("select 1 as a").fetchone() + assert row == (1,) + assert type(row) is tuple + assert cur._tx.make_row is tuple + + def test_dict_row(conn): cur = conn.cursor(row_factory=rows.dict_row) cur.execute("select 'bob' as name, 3 as id") -- 2.47.2