def test_get_change_balance_is_multiple_coins(): """ Asserts that duplicate coins are returned when there is a leftover balance. """ machine = VendingMachine() coins = [ money.Loonie(), money.Quarter(), money.Quarter(), money.TenCent(), money.TenCent() ] for coin in coins: machine.insert_coin(coin) assert machine.get_change() == coins
def test_insert_coins_stores_on_object(): """ Given that coins are inserted in to the vending machine, they should be stored on the object as a inserted_coins property. """ machine = VendingMachine() coins = [money.Toonie(), money.TenCent(), money.FiveCent()] for coin in coins: machine.insert_coin(coin) assert machine.inserted_coins == coins
def test_get_balance_returns_the_sum_of_inserted_coins(): """ Given each type of coin is inserted, a dollar amount of 3.40 should be returned. """ machine = VendingMachine() machine.insert_coin(money.Toonie()) machine.insert_coin(money.Loonie()) machine.insert_coin(money.Quarter()) machine.insert_coin(money.TenCent()) machine.insert_coin(money.FiveCent()) assert machine.get_balance() == money.DollarAmount('3.40')
def test_get_change_balance_is_all_coins(): """ Asserts that different coins are returned to complete balance. """ machine = VendingMachine() coins = [ money.Toonie(), money.Loonie(), money.Quarter(), money.TenCent(), money.FiveCent() ] for coin in coins: machine.insert_coin(coin) assert machine.get_change() == coins
def test_insert_ten_cents(): """ Given a ten cent coin, no error should be raised. """ machine = VendingMachine() machine.insert_coin(money.TenCent())