From: Jörg Breitbart Date: Fri, 12 Sep 2025 09:02:19 +0000 (+0200) Subject: testcase for pagination X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21cf03bcb2e2aa781f9cac74112f69b7f4f2685c;p=thirdparty%2Fpsycopg.git testcase for pagination --- 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