示例#1
0
def wallet():
    '''Returns a Wallet instance with a balance of 20'''
    return Wallet(20)
def my_wallet():
    '''Returns a Wallet instance with a zero balance'''
    return Wallet()
示例#3
0
def test_default_initial_amount():
    wallet = Wallet()
    assert wallet.balance == 0
示例#4
0
def test_wallet_spend_cash_raises_exception_on_insufficient_amount():
    wallet = Wallet()
    with pytest.raises(InsufficientAmount):
        wallet.spend_cash(100)
示例#5
0
def test_wallet_spend_cash():
    wallet = Wallet(20)
    wallet.spend_cash(10)
    assert wallet.balance == 10
示例#6
0
def test_wallet_add_cash():
    wallet = Wallet(10)
    wallet.add_cash(90)
    assert wallet.balance == 100
示例#7
0
def test_setting_initial_amount():
    wallet = Wallet(100)
    assert wallet.balance == 100