Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinhe-Chen committed May 9, 2024
1 parent f30b2b5 commit 351bde0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
7 changes: 4 additions & 3 deletions idaes/apps/grid_integration/forecaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md
# for full copyright and license information.
#################################################################################
import pandas as pd
from abc import ABC, abstractmethod
from numbers import Real
import numpy as np
import idaes.logger as idaeslog
import pandas as pd


_logger = idaeslog.getLogger(__name__)

Expand Down Expand Up @@ -699,7 +698,9 @@ def __init__(self, data_path_or_df):
elif isinstance(data_path_or_df, pd.DataFrame):
self.data = data_path_or_df
else:
raise ValueError
raise ValueError(
"The data_path_or_df should be pandas DataFrame or a string of the csv path"
)

def __getitem__(self, index):
return self.data[index]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

import pytest
import pyomo.environ as pyo
from pyomo.common import unittest as pyo_unittest
from idaes.apps.grid_integration.bidder import PEMParametrizedBidder
from idaes.apps.grid_integration.forecaster import PerfectForecaster
from idaes.apps.grid_integration.tests.util import (
TestingModel,
TestingForecaster,
testing_model_data,
)
from pyomo.common import unittest as pyo_unittest
from idaes.apps.grid_integration.coordinator import prescient_avail

day_ahead_horizon = 24
Expand Down Expand Up @@ -64,9 +64,4 @@ def bidder_object():
pem_marginal_cost=30,
pem_mw=200,
)
return bidder_object


# @pytest.mark.unit
# def test_compute_day_ahead_bids():
# return
return bidder_object
8 changes: 3 additions & 5 deletions idaes/apps/grid_integration/tests/test_perfectforecaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#################################################################################

import pytest
import pandas as pd
import numpy as np
from pyomo.common import unittest as pyo_unittest
from idaes.apps.grid_integration.forecaster import PerfectForecaster
import idaes.logger as idaeslog
import pandas as pd
import numpy as np


@pytest.fixture
Expand Down Expand Up @@ -52,7 +52,7 @@ def test_create_perfectforecaster(wind_df):
@pytest.mark.unit
@pytest.mark.parametrize("value", [np.array([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]])
def test_create_perfectforecaster_with_ndarray_and_list(value):
with pytest.raises(ValueError):
with pytest.raises(ValueError, match=r".*The data_path_or_df should be pandas DataFrame or a string of the csv path.*"):
perfectforecaster = PerfectForecaster(value)


Expand All @@ -70,7 +70,6 @@ def test_get_column_from_data(base_perfectforecaster):
pyo_unittest.assertStructuredAlmostEqual(
first=result_forecast.tolist(), second=expected_forecast
)
return


@pytest.mark.unit
Expand All @@ -87,7 +86,6 @@ def test_forecast_day_ahead_prices(base_perfectforecaster):
pyo_unittest.assertStructuredAlmostEqual(
first=result_forecast.tolist(), second=expected_forecast
)
return


@pytest.mark.unit
Expand Down

0 comments on commit 351bde0

Please sign in to comment.