def test_check_efficiency_of_storage_capacity_is_0(get_dict_vals):
    dict_values = get_dict_vals
    # get storage label (test will work also if 'storage_01' is renamed
    storage_label = list(dict_values[ENERGY_STORAGE])[0]
    # change value of efficiency
    dict_values[ENERGY_STORAGE][storage_label][STORAGE_CAPACITY][EFFICIENCY][
        VALUE] = 0

    with pytest.raises(ValueError):
        C1.check_efficiency_of_storage_capacity(
            dict_values
        ), f"Although the efficiency of a 'storage_capacity' is zero, no ValueError is risen."
def test_check_efficiency_of_storage_capacity_is_btw_0_and_02(
        get_dict_vals, caplog):
    dict_values = get_dict_vals
    # get storage label (test will work also if 'storage_01' is renamed
    storage_label = list(dict_values[ENERGY_STORAGE])[0]
    # change value of efficiency
    dict_values[ENERGY_STORAGE][storage_label][STORAGE_CAPACITY][EFFICIENCY][
        VALUE] = 0.1

    with caplog.at_level(logging.WARNING):
        C1.check_efficiency_of_storage_capacity(dict_values)
    assert (
        "You might use an old input file!" in caplog.text
    ), f"Although the efficiency of a 'storage_capacity' is 0.1, no warning is logged."
def test_check_efficiency_of_storage_capacity_is_greater_02(
        get_dict_vals, caplog):
    dict_values = get_dict_vals
    # get storage label (test will work also if 'storage_01' is renamed
    storage_label = list(dict_values[ENERGY_STORAGE])[0]
    # change value of efficiency
    dict_values[ENERGY_STORAGE][storage_label][STORAGE_CAPACITY][EFFICIENCY][
        VALUE] = 0.3

    # no error, no logging
    with caplog.at_level(logging.WARNING):
        C1.check_efficiency_of_storage_capacity(dict_values)
    assert (
        caplog.text == ""
    ), f"Although the efficiency of a 'storage_capacity' is 0.3, a warning is logged or error is risen."