Skip to content

Commit c830863

Browse files
test(sqlalchemy): pin max_total_rows URL-query parsing (ISSUE-95)
Parameterized tests for the max_total_rows=... URL query parameter: forwarded correctly, co-exists with timeout=..., rejects a non-integer string. Previously the allowlist entry existed but no test exercised it.
1 parent fd94619 commit c830863

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/test_dialect_dialect_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ def test_unparseable_timeout_raises(self) -> None:
6868
with pytest.raises(ArgumentError, match="float"):
6969
dialect.create_connect_args(url)
7070

71+
def test_max_total_rows_forwarded(self) -> None:
72+
"""ISSUE-95: max_total_rows URL param plumbs through to the DBAPI."""
73+
dialect = DqliteDialect()
74+
url = make_url("dqlite://host:19001/db?max_total_rows=5000")
75+
_, kwargs = dialect.create_connect_args(url)
76+
assert kwargs["max_total_rows"] == 5000
77+
78+
def test_max_total_rows_unparseable_raises(self) -> None:
79+
dialect = DqliteDialect()
80+
url = make_url("dqlite://host:19001/db?max_total_rows=not-an-int")
81+
with pytest.raises(ArgumentError, match="int"):
82+
dialect.create_connect_args(url)
83+
84+
def test_timeout_and_max_total_rows_together(self) -> None:
85+
dialect = DqliteDialect()
86+
url = make_url("dqlite://host:19001/db?timeout=3.5&max_total_rows=250")
87+
_, kwargs = dialect.create_connect_args(url)
88+
assert kwargs["timeout"] == 3.5
89+
assert kwargs["max_total_rows"] == 250
90+
7191

7292
class TestDoPingNarrowExceptions:
7393
def test_returns_true_on_success(self) -> None:

0 commit comments

Comments
 (0)