def test_wallet_add_cash(): """ Add cash to wallet """ wallet = Wallet(10) wallet.add_cash(90) assert wallet.balance == 100
def test_amount_passed_to_add_amount(): """Does the wallet throw an error when a null amount is passed to the wallet methods?""" wallet = Wallet(100) with pytest.raises(TypeError): wallet.spend_cash() with pytest.raises(TypeError): wallet.add_cash()
def test_transactions(earned, spent, expected): my_wallet = Wallet() my_wallet.add_cash(earned) my_wallet.spend_cash(spent) assert my_wallet.balance == expected # @pytest.fixture # def my_wallet(): # '''Returns a Wallet instance with a zero balance''' # return Wallet() # # @pytest.mark.parametrize("earned,spent,expected", [ # (30, 10, 20), # (20, 2, 18), # ]) # def test_transactions(my_wallet, earned, spent, expected): # my_wallet.add_cash(earned) # my_wallet.spend_cash(spent) # assert my_wallet.balance == expected
def test_wallet_add_cash(): 'Test function add_cash' wallet = Wallet(10) wallet.add_cash(90) assert wallet.balance == 100
def test_transactions(earned, spent, expected): my_wallet = Wallet() my_wallet.add_cash(earned) my_wallet.spend_cash(spent) assert my_wallet.balance == expected
def test_wallet_add_cash(): wallet = Wallet(10) wallet.add_cash(90) assert wallet.balance == 100
def test_check_updated_balance_on_add_cash(): """Is the wallet updated with funds on adding of cash?""" wallet = Wallet(100) wallet.add_cash(500) assert wallet.balance == 600
def test_wallet_add_cash(): """Testing add_cash method in wallet object""" wallet = Wallet(10) wallet.add_cash(90) assert wallet.balance == 100
def test_transactions(earned, spent, expected_balance): wallet = Wallet() wallet.add_cash(earned) wallet.spend_cash(spent) assert wallet.balance == expected_balance
def test_amount_adding(): wallet = Wallet(10) wallet.add_cash(20) assert wallet.balance == 30
def add_cash(): wallet = Wallet(100) wallet.add_cash(100) assert wallet.balance == 200