fix: preserve complete source snapshots and exports

This commit is contained in:
Aleksandr Meshchryakov
2026-10-05 17:49:22 +02:00
parent 3ce9898c0e
commit b1710408fd
7 changed files with 110 additions and 1 deletions

View File

@@ -235,6 +235,33 @@ def test_unknown_columns_rejected():
adapter().iss_rows({"x": block(["wrong"], [])}, "x", {"secid"})
@pytest.mark.parametrize("total", [1, 100, 101])
def test_cursor_stops_after_complete_final_page(total):
from io import BytesIO
from unittest.mock import Mock
module = adapter()
collector = module._Collector(None, BytesIO())
columns = sorted(module.REFERENCE_COLUMNS)
def read(url, params):
start = params["start"]
rows = [dict.fromkeys(columns) for _ in range(start, min(start + 100, total))]
for n, row in enumerate(rows, start):
row["secid"] = f"S{n}"
return {
"securities": block(columns, [[r[c] for c in columns] for r in rows]),
"securities.cursor": block(
["INDEX", "TOTAL", "PAGESIZE"], [[start, total, 100]]
),
}
collector.read = Mock(side_effect=read)
rows = list(collector.reference("bonds"))
assert len(rows) == total
assert collector.read.call_count == (total + 99) // 100
def test_outside_directory_is_counted_without_parameter_requests(scenario):
scenario[0].delete()
scenario[3].by_inn.pop("7707083893")