def test_call_with_7():
    """
    When the balance is 7, 5 should be returned. The vending
    machine's lowest denomination is 5 and will keep any extra
    balance.
    """
    assert return_change(7) == [5]
Ejemplo n.º 2
0
def test_balance_300_cents():
    """
    Assert that 1 x $1 and 1 x $2 is returned when change is 300.
    """
    assert vending_machine.return_change(300) == [200, 100]
Ejemplo n.º 3
0
def test_balance_400_cents():
    """
    Assert that 2 x $2 are returned when change is 400.
    """
    assert vending_machine.return_change(400) == [200, 200]
Ejemplo n.º 4
0
def test_balance_25_cents():
    """
    Assert that one quarter is returned when balance is 25.
    """
    assert vending_machine.return_change(25) == [25]
def test_call_with_zero():
    """
    When no balance exists, no coins should be returned.
    """
    assert return_change(0) == []
def test_call_with_negative():
    """
    When the balance is negative, no coins should be returned. The
    vending machine company won't make money by giving away money.
    """
    assert return_change(-9) == []
def test_300_balance():
    assert vending_machine.return_change(300) == [200,100]
Ejemplo n.º 8
0
def test_negative_balance():
    """
    Assert that negative values return no change.
    """
    assert vending_machine.return_change(-25) == []
def test_call_with_300():
    """
    When the balance is 300, a 200 and 100 coin should be returned.
    """
    assert return_change(300) == [200, 100]
def test_call_with_400():
    """
    When the balance is 400, two 200 coins should be returned.
    """
    assert return_change(400) == [200, 200]
def test_call_with_25():
    """
    When the balance is 25, 25 should be returned in the list.
    """
    assert return_change(25) == [25]
def test_0_balance():
    assert vending_machine.return_change(0) == []
def test_negative_balance():
    assert vending_machine.return_change(-5) == []
def test_7_balance():
    assert vending_machine.return_change(7) == [5]
def test_265_balance():
    assert vending_machine.return_change(265) == [200, 25, 25, 10, 5]
Ejemplo n.º 16
0
def test_balance_265_cents():
    """
    Assert that 1 x $2, 2 x $0.25, 1 x $0.10 and 1 x $0.05 is returned
    when change is 265.
    """
    assert vending_machine.return_change(265) == [200, 25, 25, 10, 5]
Ejemplo n.º 17
0
def test_balance_7_cents():
    """
    Assert that 7 cents is rounded down to 5 cents.
    """
    assert vending_machine.return_change(7) == [5]
def test_call_with_265():
    """
    When the balance is 265, a 200, two 25, a 10 and 5 coin
    should be returned.
    """
    assert return_change(265) == [200, 25, 25, 10, 5]
Ejemplo n.º 19
0
def test_no_change_required():
    """
    Assert that no change returned when balance is 0.
    """
    assert vending_machine.return_change(0) == []
def test_25_balance():
    assert vending_machine.return_change(25) == [25]