Skip to content

Commit 1eb1d43

Browse files
committed
fix(test_polling_source): update test_zero_row_batch_is_not_accumulated for _batches API
ITL-617 replaced _accumulated_stream with an append-only _batches list. Zero-row batches produce empty ArrowTableStream entries in _batches, so the assertion must count total rows across all batches rather than batch-list length. Also rename DESIGN_ISSUES PS4 entry to PS5 to avoid collision with the ITL-617 PS4 entry that was added to main.
1 parent 7f4cdaa commit 1eb1d43

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

tests/test_channels/test_polling_source.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,12 @@ async def test_zero_row_batch_after_nullable_column_streams_cleanly(self):
13681368

13691369
@pytest.mark.asyncio
13701370
async def test_zero_row_batch_is_not_accumulated(self):
1371-
"""After zero-row polls, the internal accumulated stream must hold only the real rows."""
1371+
"""After zero-row polls, the total row count across all batches must be exactly 1.
1372+
1373+
``_batches`` is append-only and stores each batch individually (including
1374+
zero-row ones). Zero-row batches contain no data rows, so the accumulated
1375+
total must equal the number of real rows that were fetched — exactly 1.
1376+
"""
13721377
src = PollingSource(
13731378
self._make_emit_once_then_empty_impl(),
13741379
tag_columns="id",
@@ -1378,9 +1383,11 @@ async def test_zero_row_batch_is_not_accumulated(self):
13781383
async for _ in src.async_iter_data():
13791384
pass
13801385

1381-
assert len(src._batches) == 1, "_batches must contain exactly one batch after iteration"
1382-
cached = list(src._batches[0].iter_data())
1383-
assert len(cached) == 1
1386+
assert src._batches, "_batches must be non-empty after iteration"
1387+
all_rows = [row for batch in src._batches for row in batch.iter_data()]
1388+
assert len(all_rows) == 1, (
1389+
f"Expected exactly 1 row across all batches, got {len(all_rows)}"
1390+
)
13841391

13851392
# ------------------------------------------------------------------
13861393
# Test 3: declared-schema path — zero-row polls, no warning

0 commit comments

Comments
 (0)