Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 1, 2024
1 parent cea9d28 commit ec22378
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_adjuster.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import pandas as pd
import pytest

from pvsite_datamodel.sqlmodels import SiteAssetType

from india_forecast_app.adjuster import (
adjust_forecast_with_adjuster,
get_me_values,
Expand Down Expand Up @@ -80,6 +82,9 @@ def test_adjust_forecast_with_adjuster(db_session, sites, generation_db_values,
{
"forecast_power_kw": [1, 2, 3, 4, 5],
"horizon_minutes": [15, 30, 45, 60, 1200],
"start_utc": [
pd.Timestamp("2024-11-01 03:00:00") + pd.Timedelta(f"{i}H") for i in range(0, 5)
],
}
)

Expand All @@ -100,6 +105,9 @@ def test_adjust_forecast_with_adjuster_no_values(db_session, sites):
{
"forecast_power_kw": [1, 2, 3, 4, 5],
"horizon_minutes": [15, 30, 45, 60, 1200],
"start_utc": [
pd.Timestamp("2024-11-01 03:00:00") + pd.Timedelta(f"{i}H") for i in range(0, 5)
],
}
)

Expand All @@ -111,7 +119,7 @@ def test_adjust_forecast_with_adjuster_no_values(db_session, sites):
assert forecast_values_df["forecast_power_kw"].sum() == 15


@pytest.mark.parametrize("asset_type", ["pv", "wind"])
@pytest.mark.parametrize("asset_type", [SiteAssetType.pv, SiteAssetType.wind])
def test_zero_out_night_time_for_pv(asset_type, db_session, sites):
""" Test for zero_out_nighttime """
forecast_values_df = pd.DataFrame(
Expand All @@ -132,7 +140,7 @@ def test_zero_out_night_time_for_pv(asset_type, db_session, sites):

assert len(forecast_values_df) == 5
night_sum = forecast_values_df["forecast_power_kw"][0:2].sum()
if asset_type == "pv":
if asset_type == SiteAssetType.pv:
assert night_sum == 0
else:
assert night_sum > 0
Expand Down

0 comments on commit ec22378

Please sign in to comment.