Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Mar 11, 2024
1 parent c68e5d3 commit 4e6de86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tests/test_national.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from main import app
from pydantic_models import NationalForecast, NationalForecastValue

from freezegun import freeze_time


def test_read_latest_national_values(db_session, api_client):
"""Check main solar/GB/national/forecast route works"""
Expand Down Expand Up @@ -103,6 +105,7 @@ def test_read_latest_national_values_start_and_end_filters(db_session, api_clien
assert len(national_forecast_values) == 9


@freeze_time("2024-01-01")
def test_get_national_forecast(db_session, api_client):
"""Check main solar/GB/national/forecast route works"""

Expand Down Expand Up @@ -212,8 +215,8 @@ def test_read_latest_national_values_properties(db_session, api_client):
national_forecast_values = [NationalForecastValue(**f) for f in response.json()]
assert national_forecast_values[0].plevels is not None
# index 24 is the middle of the day
assert np.round(national_forecast_values[24].plevels["plevel_10"], 2) == np.round(
national_forecast_values[24].expected_power_generation_megawatts * 0.9, 2
assert np.abs(np.round(national_forecast_values[24].plevels["plevel_10"], 2) - np.round(
national_forecast_values[24].expected_power_generation_megawatts * 0.9, 2) < 0.02
)


Expand Down

0 comments on commit 4e6de86

Please sign in to comment.