Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Nov 13, 2024
1 parent 02bf00d commit 0e77235
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import zarr
from pvsite_datamodel import DatabaseConnection
from pvsite_datamodel.read.model import get_or_create_model
from pvsite_datamodel.sqlmodels import Base, GenerationSQL, ForecastSQL, ForecastValueSQL, SiteSQL
from pvsite_datamodel.sqlmodels import Base, ForecastSQL, ForecastValueSQL, GenerationSQL, SiteSQL
from sqlalchemy import create_engine
from testcontainers.postgres import PostgresContainer

Expand Down
9 changes: 8 additions & 1 deletion tests/test_adjuster.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
""" Test for adjuster.py """
from datetime import datetime

import pandas as pd

from india_forecast_app.adjuster import get_me_values, adjust_forecast_with_adjuster
from india_forecast_app.adjuster import adjust_forecast_with_adjuster, get_me_values


def test_get_me_values_no_values(db_session, sites):
"""Check no ME results are found with no forecast or generation values"""

me_df = get_me_values(db_session, 10, site_uuid=sites[0].site_uuid, ml_model_name="test")

assert len(me_df) == 0


def test_get_me_values(db_session, sites, generation_db_values, forecasts):
"""Check ME results are found"""

hour = pd.Timestamp(datetime.now()).hour
me_df = get_me_values(db_session, hour, site_uuid=sites[0].site_uuid, ml_model_name="test")
Expand All @@ -21,6 +24,7 @@ def test_get_me_values(db_session, sites, generation_db_values, forecasts):


def test_get_me_values_no_generation(db_session, sites, forecasts):
"""Check no ME results are found with no generation values"""

hour = pd.Timestamp(datetime.now()).hour
me_df = get_me_values(db_session, hour, site_uuid=sites[0].site_uuid, ml_model_name="test")
Expand All @@ -29,6 +33,7 @@ def test_get_me_values_no_generation(db_session, sites, forecasts):


def test_get_me_values_no_forecasts(db_session, sites, generation_db_values):
"""Check no ME results are found with no generation values"""

hour = pd.Timestamp(datetime.now()).hour
me_df = get_me_values(db_session, hour, site_uuid=sites[0].site_uuid, ml_model_name="test")
Expand All @@ -37,6 +42,7 @@ def test_get_me_values_no_forecasts(db_session, sites, generation_db_values):


def test_adjust_forecast_with_adjuster(db_session, sites, generation_db_values, forecasts):
"""Check forecast gets adjuster"""
forecast_meta = {"timestamp_utc": datetime.now(), "site_uuid": sites[0].site_uuid}
forecast_values_df = pd.DataFrame(
{
Expand All @@ -56,6 +62,7 @@ def test_adjust_forecast_with_adjuster(db_session, sites, generation_db_values,


def test_adjust_forecast_with_adjuster_no_values(db_session, sites):
"""Check forecast doesnt adjuster, no me values"""
forecast_meta = {"timestamp_utc": datetime.now(), "site_uuid": sites[0].site_uuid}
forecast_values_df = pd.DataFrame(
{
Expand Down

0 comments on commit 0e77235

Please sign in to comment.