def empty_wallet(): """ Returns a Wallet instance with a zero balance """ return Wallet()
def wallet_wealthy(): """ Returns a Wallet instance with a balance of 20 """ return Wallet(1000000)
def wallet(): """ Returns a Wallet instance with a balance of 20 """ return Wallet(20)
def test_transactions(empty_wallet: Wallet, earned: float, spent: float, expected: float) -> None: empty_wallet.add_cash(earned) empty_wallet.spend_cash(spent) assert empty_wallet.balance == expected
def test_wallet_spend_cash_raises_exception_on_insufficient_amount( wallet: Wallet) -> None: with pytest.raises(InsufficientAmountException): wallet.spend_cash(100)
def test_wallet_spend_cash(wallet: Wallet) -> None: wallet.spend_cash(10) assert wallet.balance == 10
def test_wallet_add_cash(wallet: Wallet) -> None: wallet.add_cash(80) assert wallet.balance == 100