# 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_variable_exists(backend_model, constraint, variable, idx=None):
#     """
#     Search for existence of a decision variable in a Pyomo constraint.
# 
#     Parameters
#     ----------
#     backend_model : Pyomo ConcreteModel
#     constraint : str, name of constraint which could exist in the backend
#     variable : str, string to search in the list of variables to check if existing
#     """
#     if getattr(backend_model, constraint) in backend_model.component_objects(
#         ctype=po.Constraint
#     ):
#         expression_accessor = "body"
#     elif getattr(backend_model, constraint) in backend_model.component_objects(
#         ctype=po.Expression
#     ):
#         expression_accessor = "value"
#     if idx is not None:
#         if idx in getattr(backend_model, constraint)._index:
#             variables = identify_variables(
#                 getattr(getattr(backend_model, constraint)[idx], expression_accessor)
#             )
#             return any(variable in j.getname() for j in list(variables))
#         else:
#             return False
#     else:
#         exists = []
#         for v in getattr(backend_model, constraint).values():
#             variables = identify_variables(getattr(v, expression_accessor))
#             exists.append(any(variable in j.getname() for j in list(variables)))
#         return any(exists)


import pytest  # noqa: F401
from calliope.test.common.util import build_test_model as build_model
from calliope.test.common.util import check_variable_exists



class TestBuildConversionPlusConstraints:
    # conversion_plus.py
    def test_no_balance_conversion_plus_primary_constraint(self):
        """
        sets.loc_techs_conversion_plus,
        """

# 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_variable_exists(backend_model, constraint, variable, idx=None):
#     """
#     Search for existence of a decision variable in a Pyomo constraint.
# 
#     Parameters
#     ----------
#     backend_model : Pyomo ConcreteModel
#     constraint : str, name of constraint which could exist in the backend
#     variable : str, string to search in the list of variables to check if existing
#     """
#     if getattr(backend_model, constraint) in backend_model.component_objects(
#         ctype=po.Constraint
#     ):
#         expression_accessor = "body"
#     elif getattr(backend_model, constraint) in backend_model.component_objects(
#         ctype=po.Expression
#     ):
#         expression_accessor = "value"
#     if idx is not None:
#         if idx in getattr(backend_model, constraint)._index:
#             variables = identify_variables(
#                 getattr(getattr(backend_model, constraint)[idx], expression_accessor)
#             )
#             return any(variable in j.getname() for j in list(variables))
#         else:
#             return False
#     else:
#         exists = []
#         for v in getattr(backend_model, constraint).values():
#             variables = identify_variables(getattr(v, expression_accessor))
#             exists.append(any(variable in j.getname() for j in list(variables)))
#         return any(exists)


# Path: calliope/test/test_backend_pyomo_constraints_conversion_plus.py
import pytest  # noqa: F401
from calliope.test.common.util import build_test_model as build_model
from calliope.test.common.util import check_variable_exists




class TestBuildConversionPlusConstraints:
    # conversion_plus.py
    def test_no_balance_conversion_plus_primary_constraint(self):
        """
        sets.loc_techs_conversion_plus,
        """

        m = build_model({}, "simple_supply,two_hours,investment_costs")