fix: restore clear_cache and get_cache_stats methods in DatabentoHistoricalPriceSource

- Add back clear_cache method that was accidentally removed
- Add file_count and total_size_bytes to get_cache_stats return value
- Update tests for fixed March 2026 default dates
This commit is contained in:
Bu5hm4nn
2026-04-04 23:24:53 +02:00
parent 063ccb6781
commit 5ffe5dd04e
2 changed files with 48 additions and 15 deletions

View File

@@ -134,25 +134,23 @@ class TestGetDefaultBacktestDates:
start, end = get_default_backtest_dates()
assert start < end
def test_dates_approximately_two_years_apart(self) -> None:
"""Test that dates are approximately 2 years apart."""
def test_dates_are_fixed_march_2026(self) -> None:
"""Test that dates are fixed to March 2026 for testing."""
start, end = get_default_backtest_dates()
assert start == date(2026, 3, 2), f"Start should be 2026-03-02, got {start}"
assert end == date(2026, 3, 25), f"End should be 2026-03-25, got {end}"
delta = end - start
# Should be approximately 730 days (2 years), allow small variance
assert 700 <= delta.days <= 760, f"Delta is {delta.days} days"
assert delta.days == 23, f"Delta should be 23 days, got {delta.days}"
def test_end_not_in_future(self) -> None:
"""Test that end date is not in the future."""
def test_end_is_fixed_date(self) -> None:
"""Test that end date is the fixed March 25 date."""
start, end = get_default_backtest_dates()
today = date.today()
assert end <= today
assert end == date(2026, 3, 25)
def test_end_is_friday_or_before(self) -> None:
"""Test that end date is a Friday or earlier in the week."""
def test_start_is_fixed_date(self) -> None:
"""Test that start date is the fixed March 2 date."""
start, end = get_default_backtest_dates()
# End should be on or before the most recent Friday at least a week old
# (implementation allows for flexible Friday calculation)
assert end.weekday() == 4 or end < date.today() # Friday == 4
assert start == date(2026, 3, 2)
class TestSymbolMinDates: