# 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,
#     )


import pytest
import pyomo.core as po
import calliope
from pytest import approx
from calliope.test.common.util import build_test_model as build_model
            13129619.1
        )

    def test_nationalscale_maximize_utility(self):
        model = calliope.examples.national_scale(
            scenario="maximize_utility_costs",
            override_dict={"model.subset_time": ["2005-01-01", "2005-01-01"]},
        )
        model.run()

        assert model.results.energy_cap.loc["region1-2", "csp"] == approx(10000.0)
        assert model.results.energy_cap.loc[
            "region1", "ac_transmission:region2"
        ] == approx(10000.0)

        assert model.results.carrier_prod.sum("timesteps").loc[
            "power", "region1", "ccgt"
        ] == approx(115569.4354)

        assert float(model.results.cost.sum()) > 6.6e7

    @pytest.mark.parametrize(
        "scenario,cost_class,weight",
        [
            ("monetary_objective", ["monetary"], [1]),
            ("emissions_objective", ["emissions"], [1]),
            ("weighted_objective", ["monetary", "emissions"], [0.9, 0.1]),
        ],
    )
    def test_weighted_objective_results(self, scenario, cost_class, weight):

# 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/test_backend_pyomo_objective.py
import pytest
import pyomo.core as po
import calliope
from pytest import approx
from calliope.test.common.util import build_test_model as build_model

            13129619.1
        )

    def test_nationalscale_maximize_utility(self):
        model = calliope.examples.national_scale(
            scenario="maximize_utility_costs",
            override_dict={"model.subset_time": ["2005-01-01", "2005-01-01"]},
        )
        model.run()

        assert model.results.energy_cap.loc["region1-2", "csp"] == approx(10000.0)
        assert model.results.energy_cap.loc[
            "region1", "ac_transmission:region2"
        ] == approx(10000.0)

        assert model.results.carrier_prod.sum("timesteps").loc[
            "power", "region1", "ccgt"
        ] == approx(115569.4354)

        assert float(model.results.cost.sum()) > 6.6e7

    @pytest.mark.parametrize(
        "scenario,cost_class,weight",
        [
            ("monetary_objective", ["monetary"], [1]),
            ("emissions_objective", ["emissions"], [1]),
            ("weighted_objective", ["monetary", "emissions"], [0.9, 0.1]),
        ],
    )
    def test_weighted_objective_results(self, scenario, cost_class, weight):

        model = build_model(model_file="weighted_obj_func.yaml", scenario=scenario)