Exemplo n.º 1
0
def test_insert_fifty():
    """
    Given 50, a ValueError should be raised.
    """
    inserted_coins = []
    with pytest.raises(ValueError):
        insert_coin(50, inserted_coins)
Exemplo n.º 2
0
def test_fifty_cents():
    """
    Asserts that given a 50 cent coin, the vending machine will output
    an error since 50 cent coins are rare.
    """
    inserted_coins = []
    with pytest.raises(ValueError):
        vending_machine.insert_coin(50, inserted_coins)
Exemplo n.º 3
0
def test_insert_five():
    """
    Given 5 to an empty list of coins, 5 should be
    appended.
    """
    inserted_coins = []
    insert_coin(5, inserted_coins)

    assert inserted_coins == [5]
Exemplo n.º 4
0
def test_insert_200():
    """
    Given 200 to an empty list of coins, 200 should be
    appended.
    """
    inserted_coins = []
    insert_coin(200, inserted_coins)

    assert inserted_coins == [200]
Exemplo n.º 5
0
def test_insert_ten():
    """
    Given 10 to an empty list of coins, 10 should be
    appended.
    """
    inserted_coins = []
    insert_coin(10, inserted_coins)

    assert inserted_coins == [10]
Exemplo n.º 6
0
def test_insert_twenty_five():
    """
    Given 25 to an empty list of coins, 25 should be
    appended.
    """
    inserted_coins = []
    insert_coin(25, inserted_coins)

    assert inserted_coins == [25]
Exemplo n.º 7
0
def test_five_cents():
    """
    Asserts that given a 5 cent coin, the vending machine receives the coin.
    """
    inserted_coins = []
    assert vending_machine.insert_coin(5, inserted_coins) == [5]
Exemplo n.º 8
0
def test_coin_insertion():
    """
    Asserts that given a 5 cent coin, the vending machine receives the coin.
    """
    inserted_coins = [5, 100]
    assert vending_machine.insert_coin(25, inserted_coins) == [5, 100, 25]
Exemplo n.º 9
0
def test_two_dollars():
    """
    Asserts that given a 2 dollar coin, the vending machine receives the coin.
    """
    inserted_coins = []
    assert vending_machine.insert_coin(200, inserted_coins) == [200]
Exemplo n.º 10
0
def test_one_dollar():
    """
    Asserts that given a 1 dollar coin, the vending machine receives the coin.
    """
    inserted_coins = []
    assert vending_machine.insert_coin(100, inserted_coins) == [100]
Exemplo n.º 11
0
def test_ten_cents():
    """
    Asserts that given a 10 cent coin, the vending machine receives the coin.
    """
    inserted_coins = []
    assert vending_machine.insert_coin(10, inserted_coins) == [10]
def test_invalid_coin_value():
    """
    When given a bogus coin value, raise a ValueError.
    """
    with pytest.raises(ValueError):
        insert_coin(99, [])
def test_200_cents():
    """Tests 200 cents being entered into machine."""
    inserted_coins = []
    insert_coin(200, inserted_coins)
    assert inserted_coins == [200]
def test_25_cents():
    """Tests 25 cents being entered into machine."""
    inserted_coins = []
    insert_coin(25, inserted_coins)
    assert inserted_coins == [25]
def test_ten_cents():
    """Tests 10 cents being entered into machine."""
    inserted_coins = []
    insert_coin(10, inserted_coins)
    assert inserted_coins == [10]
def test_five_cents():
    """Tests 5 cents being entered into machine."""
    inserted_coins = []
    insert_coin(5, inserted_coins)
    assert inserted_coins == [5]