From df662f33a61cc19f0a46ee86664d3cf54743ded2 Mon Sep 17 00:00:00 2001 From: Megawattz Date: Fri, 24 Jan 2025 12:02:44 +0100 Subject: [PATCH] update forecast test with no ts --- tests/unit/test_forecast_no_ts.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/unit/test_forecast_no_ts.py b/tests/unit/test_forecast_no_ts.py index 0450379d..a66b7b1c 100644 --- a/tests/unit/test_forecast_no_ts.py +++ b/tests/unit/test_forecast_no_ts.py @@ -7,22 +7,21 @@ def test_run_forecast_no_ts(): # make input data site = PVSite(latitude=51.75, longitude=-1.25, capacity_kwp=1.25) - current_ts = pd.Timestamp.now().round("15min") - current_hr = pd.Timestamp.now().round(freq='h') + current_ts = pd.Timestamp.now() # run gradient boosting model with no ts - predications_df = run_forecast(site=site, model="gb", ts=current_ts) + predications_df = run_forecast(site=site, model="gb") # check current ts agrees with dataset - assert predications_df.index.min() == current_ts + assert predications_df.index.min() >= current_ts - pd.Timedelta(hours=1) print(predications_df) print(f"Current time: {current_ts}") print(f"Max: {predications_df['power_kw'].max()}") # run xgb model with no ts - predications_df = run_forecast(site=site, model="xgb", ts=current_ts) + predications_df = run_forecast(site=site, model="xgb") # check current ts agrees with dataset - assert predications_df.index.min() == current_hr + assert predications_df.index.min() >= current_ts - pd.Timedelta(hours=1) print(predications_df) print(f"Current time: {current_ts}")