fix(data): restore pagination early-break + update test count

Code review on b977c37 flagged: with dataset smaller than limit=1000
(typical Phase 1 case), the loop made an extra HTTP request that
returned duplicate rows. Restored `if len(rows) < limit: break`
after extending. Test assertion adjusted from 2 to 1 calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 19:06:50 +02:00
parent b977c371e5
commit 116879400a
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ def test_loader_uses_cache_on_second_call(tmp_path: Path, mocker, sample_ohlcv_r
df1 = loader.load(req)
df2 = loader.load(req)
assert fake_exchange.fetch_ohlcv.call_count == 2 # paginazione interna, non caching
assert fake_exchange.fetch_ohlcv.call_count == 1 # 48 < limit, single batch
pd.testing.assert_frame_equal(df1, df2)
# Seconda chiamata legge da cache, non chiama exchange
fake_exchange.fetch_ohlcv.reset_mock()