From: Daniele Varrazzo Date: Wed, 24 Feb 2021 18:22:50 +0000 (+0100) Subject: Add tuple_row test X-Git-Tag: 3.0.dev0~106^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa81751e1cfa9876faaa16b8a1c907c254a4cce1;p=thirdparty%2Fpsycopg.git Add tuple_row test --- 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")