]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
testcase for pagination
authorJörg Breitbart <jerch@rockborn.de>
Fri, 12 Sep 2025 09:02:19 +0000 (11:02 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 13 Sep 2025 18:10:43 +0000 (20:10 +0200)
tests/test_row_pagination_c.py [new file with mode: 0644]

diff --git a/tests/test_row_pagination_c.py b/tests/test_row_pagination_c.py
new file mode 100644 (file)
index 0000000..6b73831
--- /dev/null
@@ -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