def test_equation_degree_of_autonomy():
    """ """
    total_generation = 30
    total_demand = 100
    degree_of_autonomy = E3.equation_degree_of_autonomy(
        total_generation, total_demand)
    assert degree_of_autonomy == total_generation / total_demand, (
        f"The degree_of_autonomy ({degree_of_autonomy}) is not calculated correctly. "
        f"It should be equal to {total_generation / total_demand }.")
コード例 #2
0
def test_equation_degree_of_autonomy():
    """ """
    total_consumption_from_grid = 30
    total_demand = 100
    degree_of_autonomy = E3.equation_degree_of_autonomy(
        total_consumption_from_grid, total_demand
    )
    exp = (total_demand - total_consumption_from_grid) / total_demand
    assert degree_of_autonomy == exp, (
        f"The degree_of_autonomy ({degree_of_autonomy}) is not calculated correctly. "
        f"It should be equal to {exp}."
    )