test: improve test for ohlcv_with_cache

This commit is contained in:
Matthias
2026-01-31 19:46:30 +01:00
parent beec9123d4
commit 3c2ddda203

View File

@@ -2813,6 +2813,7 @@ def test_refresh_ohlcv_with_cache(mocker, default_conf, time_machine) -> None:
ohlcv_mock.reset_mock()
res = exchange.refresh_ohlcv_with_cache(pairs, start.timestamp())
assert ohlcv_mock.call_count == 0
assert len(res) == 5
# Expire 5m cache
time_machine.move_to(start + timedelta(minutes=6), tick=False)
@@ -2821,6 +2822,7 @@ def test_refresh_ohlcv_with_cache(mocker, default_conf, time_machine) -> None:
res = exchange.refresh_ohlcv_with_cache(pairs, start.timestamp())
assert ohlcv_mock.call_count == 1
assert len(ohlcv_mock.call_args_list[0][0][0]) == 1
assert len(res) == 5
# Expire 5m and 1h cache
time_machine.move_to(start + timedelta(hours=2), tick=False)
@@ -2829,6 +2831,7 @@ def test_refresh_ohlcv_with_cache(mocker, default_conf, time_machine) -> None:
res = exchange.refresh_ohlcv_with_cache(pairs, start.timestamp())
assert ohlcv_mock.call_count == 1
assert len(ohlcv_mock.call_args_list[0][0][0]) == 2
assert len(res) == 5
# Expire all caches
time_machine.move_to(start + timedelta(days=1, hours=2), tick=False)
@@ -2838,6 +2841,7 @@ def test_refresh_ohlcv_with_cache(mocker, default_conf, time_machine) -> None:
assert ohlcv_mock.call_count == 1
assert len(ohlcv_mock.call_args_list[0][0][0]) == 5
assert ohlcv_mock.call_args_list[0][0][0] == pairs
assert len(res) == 5
def test_refresh_latest_ohlcv_funding_rate(mocker, default_conf_usdt, caplog) -> None: