# Path: calliope/test/common/util.py
# def build_test_model(
#     override_dict=None,
#     scenario=None,
#     model_file="model.yaml",
#     timeseries_dataframes=None,
# ):
#     return calliope.Model(
#         os.path.join(os.path.dirname(__file__), "test_model", model_file),
#         override_dict=override_dict,
#         scenario=scenario,
#         timeseries_dataframes=timeseries_dataframes,
#     )
# 
# Path: calliope/test/common/util.py
# def check_error_or_warning(error_warning, test_string_or_strings):
#     if hasattr(error_warning, "list"):
#         output = ",".join(
#             str(error_warning.list[i]) for i in range(len(error_warning.list))
#         )
#     else:
#         output = str(error_warning.value)
# 
#     if isinstance(test_string_or_strings, list):
#         result = all(test_string in output for test_string in test_string_or_strings)
#     else:
#         result = test_string_or_strings in output
# 
#     return result


import pytest
import calliope
from calliope.test.common.util import build_test_model as build_model
from calliope.test.common.util import check_error_or_warning



class TestDeprecationWarnings:
    def test_get_formatted_array_deprecationwarning(self):

        model = build_model(scenario="simple_supply,one_day,investment_costs")
        model.run()

        with pytest.warns(DeprecationWarning) as warning:
            model.get_formatted_array("carrier_prod")


# Path: calliope/test/common/util.py
# def build_test_model(
#     override_dict=None,
#     scenario=None,
#     model_file="model.yaml",
#     timeseries_dataframes=None,
# ):
#     return calliope.Model(
#         os.path.join(os.path.dirname(__file__), "test_model", model_file),
#         override_dict=override_dict,
#         scenario=scenario,
#         timeseries_dataframes=timeseries_dataframes,
#     )
# 
# Path: calliope/test/common/util.py
# def check_error_or_warning(error_warning, test_string_or_strings):
#     if hasattr(error_warning, "list"):
#         output = ",".join(
#             str(error_warning.list[i]) for i in range(len(error_warning.list))
#         )
#     else:
#         output = str(error_warning.value)
# 
#     if isinstance(test_string_or_strings, list):
#         result = all(test_string in output for test_string in test_string_or_strings)
#     else:
#         result = test_string_or_strings in output
# 
#     return result


# Path: calliope/test/test_core_future_warnings.py
import pytest
import calliope
from calliope.test.common.util import build_test_model as build_model
from calliope.test.common.util import check_error_or_warning




class TestDeprecationWarnings:
    def test_get_formatted_array_deprecationwarning(self):

        model = build_model(scenario="simple_supply,one_day,investment_costs")
        model.run()

        with pytest.warns(DeprecationWarning) as warning:
            model.get_formatted_array("carrier_prod")


        assert check_error_or_warning(warning, "get_formatted_array() is deprecated")