Esempio n. 1
0
def test_optimal_relevant_cost_calculates_correctly():
    import math
    raw_costs = get_raw_costs()
    demand = get_demand()

    expected = math.sqrt(2 * raw_costs.ordering_cost * raw_costs.holding_cost *
                         demand.quantity)
    actual = EOQ.optimal_relevant_cost(raw_costs=raw_costs, demand=demand)

    assert expected == actual
Esempio n. 2
0
def test_optimal_total_cost_calculates_correctly():
    raw_costs = get_raw_costs()
    demand = get_demand()

    trc = EOQ.optimal_relevant_cost(raw_costs, demand)
    expected = trc + raw_costs.unit_cost * demand.quantity

    actual = EOQ.optimal_total_cost(raw_costs=raw_costs, demand=demand)

    assert expected == actual
Esempio n. 3
0
def test_optimal_relevant_cost_with_missing_demand_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_relevant_cost(raw_costs=get_raw_costs(), demand=None)