# Path: calliope/exceptions.py
# def _formatwarning(message, category, filename, lineno, line=None):
# def warn(message, _class=ModelWarning):
# def print_warnings_and_raise_errors(warnings=None, errors=None):
# class ModelError(Exception):
# class BackendError(Exception):
# class ModelWarning(Warning):
# class BackendWarning(Warning):
# 
# 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


from calliope import exceptions
from pytest import approx
from calliope.test.common.util import check_error_or_warning
import shutil
import pytest
import pandas as pd
import numpy as np
import calliope
        model = calliope.examples.national_scale(
            scenario="check_feasibility", override_dict={"run.cyclic_storage": False}
        )

        model.run()

        assert model.results.termination_condition in [
            "infeasible",
            "other",
        ]  # glpk gives 'other' as result

        assert len(model.results.data_vars) == 0
        assert "energy_cap" not in model._model_data.data_vars

    def test_nationalscale_example_results_cbc(self):
        self.example_tester()


@pytest.mark.xfail(reason="Not expecting operate mode to work at the moment")
class TestNationalScaleExampleModelOperate:
    def example_tester(self):
        with pytest.warns(calliope.exceptions.ModelWarning) as excinfo:
            model = calliope.examples.national_scale(
                override_dict={"model.subset_time": ["2005-01-01", "2005-01-03"]},
                scenario="operate",
            )
            model.run()

        expected_warning = "Resource capacity constraint defined and set to infinity for all supply_plus techs"


# Path: calliope/exceptions.py
# def _formatwarning(message, category, filename, lineno, line=None):
# def warn(message, _class=ModelWarning):
# def print_warnings_and_raise_errors(warnings=None, errors=None):
# class ModelError(Exception):
# class BackendError(Exception):
# class ModelWarning(Warning):
# class BackendWarning(Warning):
# 
# 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_example_models.py
from calliope import exceptions
from pytest import approx
from calliope.test.common.util import check_error_or_warning
import shutil
import pytest
import pandas as pd
import numpy as np
import calliope

        model = calliope.examples.national_scale(
            scenario="check_feasibility", override_dict={"run.cyclic_storage": False}
        )

        model.run()

        assert model.results.termination_condition in [
            "infeasible",
            "other",
        ]  # glpk gives 'other' as result

        assert len(model.results.data_vars) == 0
        assert "energy_cap" not in model._model_data.data_vars

    def test_nationalscale_example_results_cbc(self):
        self.example_tester()


@pytest.mark.xfail(reason="Not expecting operate mode to work at the moment")
class TestNationalScaleExampleModelOperate:
    def example_tester(self):
        with pytest.warns(calliope.exceptions.ModelWarning) as excinfo:
            model = calliope.examples.national_scale(
                override_dict={"model.subset_time": ["2005-01-01", "2005-01-03"]},
                scenario="operate",
            )
            model.run()

        expected_warning = "Resource capacity constraint defined and set to infinity for all supply_plus techs"


        assert check_error_or_warning(excinfo, expected_warning)