test(energy-cost): pin local_now in future-window summarize test
test_future_window_counts_0_days relied on the real wall-clock date and assumed 7/1→8/1 2026 was entirely in the future; once that range started elapsing the window counted fixed-fee days and the assertion failed. Pin local_now to June 25 2026 (as the sibling window tests already do) so the case stays deterministic.
This commit is contained in:
@@ -1263,6 +1263,9 @@ class TestSummarizePrincipleC:
|
||||
def test_future_window_counts_0_days(self, energy_db: Session) -> None:
|
||||
"""A fully future window (all local dates > today) counts 0 days.
|
||||
|
||||
Pins ``local_now`` to June 25 2026 noon AMS so the 7/1→8/1 window is
|
||||
genuinely in the future regardless of the actual wall-clock date
|
||||
(mirrors the sibling window tests, which all pin ``local_now``).
|
||||
Matches table row: 7/1→8/1 (all future) → 0 days.
|
||||
"""
|
||||
eff_utc = _ams_midnight(2026, 6, 1)
|
||||
@@ -1270,7 +1273,9 @@ class TestSummarizePrincipleC:
|
||||
|
||||
start = _ams_midnight(2026, 7, 1)
|
||||
end = _ams_midnight(2026, 8, 1)
|
||||
result = self._run_summarize_ams(energy_db, start, end)
|
||||
# Pin local_now to June 25 2026 noon AMS so 7/1→8/1 stays fully future.
|
||||
pinned_now = datetime(2026, 6, 25, 12, 0, 0, tzinfo=_ams())
|
||||
result = self._run_summarize_ams(energy_db, start, end, pinned_now=pinned_now)
|
||||
|
||||
assert result["fixed_costs"] == 0.0, (
|
||||
f"All-future window must count 0 days; got fixed_costs={result['fixed_costs']}"
|
||||
|
||||
Reference in New Issue
Block a user