Skip to content

Commit 8889b81

Browse files
rustyconoverclaude
andcommitted
tests: type the continuation and pagination helpers for mypy
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent f4fa638 commit 8889b81

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎tests/table_in_out/test_continuation.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from __future__ import annotations
1313

14-
from collections.abc import Callable
14+
from collections.abc import Callable, Sequence
1515
from dataclasses import dataclass
1616
from typing import Annotated, Any
1717

@@ -40,14 +40,14 @@
4040
_INPUT_SCHEMA = make_schema([pa.field("n", pa.int64())])
4141

4242

43-
def _expected_pairs(counts: list[int | None]) -> list[tuple[int, int]]:
43+
def _expected_pairs(counts: Sequence[int | None]) -> list[tuple[int, int]]:
4444
return [(row, k) for row, n in enumerate(counts) for k in range(n or 0)]
4545

4646

4747
def _run_paged(
4848
client: Client,
4949
monkeypatch: pytest.MonkeyPatch,
50-
batches: list[list[int | None]],
50+
batches: Sequence[Sequence[int | None]],
5151
page_size: int,
5252
) -> tuple[list[tuple[int, int]], list[int]]:
5353
"""Run ``blended_paged``; return (parent_row, value) pairs and replies per input batch."""
@@ -66,12 +66,14 @@ def counting(self: Client, *args: Any, **kwargs: Any) -> Any:
6666
client.table_in_out_function(
6767
function_name="blended_paged",
6868
schema_path=["main"],
69-
input=iter([pa.RecordBatch.from_pydict({"n": counts}, schema=_INPUT_SCHEMA) for counts in batches]),
69+
input=iter(
70+
[pa.RecordBatch.from_pydict({"n": list(counts)}, schema=_INPUT_SCHEMA) for counts in batches]
71+
),
7072
arguments=Arguments(named={"page_size": pa.scalar(page_size)}),
7173
parent_row_callback=parent_rows_seen.extend,
7274
)
7375
)
74-
values = [v for batch in results for v in batch.column("i").to_pylist()]
76+
values: list[Any] = [v for batch in results for v in batch.column("i").to_pylist()]
7577
return list(zip(parent_rows_seen, values, strict=True)), replies
7678

7779

‎tests/test_examples_workers.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def counting(self: Client, *args: Any, **kwargs: Any) -> Any:
173173

174174

175175
def _all_orders(m: Any, customer_id: int) -> list[dict[str, Any]]:
176+
orders: list[dict[str, Any]]
176177
orders, cursor = m.fetch_orders_page(customer_id, "")
177178
while cursor:
178179
page, cursor = m.fetch_orders_page(customer_id, cursor)

0 commit comments

Comments
 (0)