From 21cf03bcb2e2aa781f9cac74112f69b7f4f2685c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 12 Sep 2025 11:02:19 +0200 Subject: [PATCH] testcase for pagination --- tests/test_row_pagination_c.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/test_row_pagination_c.py diff --git a/tests/test_row_pagination_c.py b/tests/test_row_pagination_c.py new file mode 100644 index 000000000..6b73831ec --- /dev/null +++ b/tests/test_row_pagination_c.py @@ -0,0 +1,16 @@ +import pytest + +@pytest.mark.parametrize('pagesize', [1, 2, 3, 5, 7]) +def test_pagesize_c(conn, pagesize): + from psycopg._cmodule import _psycopg + if not _psycopg: + return + cur = conn.cursor() + cur.execute("SELECT *, 'abc' FROM generate_series(1, 10)") + cur._tx._page_size = pagesize + result = cur.fetchall() + expected = [ + (1, 'abc'), (2, 'abc'), (3, 'abc'), (4, 'abc'), (5, 'abc'), + (6, 'abc'), (7, 'abc'), (8, 'abc'), (9, 'abc'), (10, 'abc') + ] + assert result == expected -- 2.47.3