예제 #1
0
def test_wallet_add_cash():
    """
    Add cash to wallet
    """
    wallet = Wallet(10)
    wallet.add_cash(90)
    assert wallet.balance == 100
예제 #2
0
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()    
        
예제 #3
0
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
예제 #4
0
def test_wallet_add_cash():
    'Test function add_cash'
    wallet = Wallet(10)
    wallet.add_cash(90)
    assert wallet.balance == 100
예제 #5
0
def test_transactions(earned, spent, expected):
    my_wallet = Wallet()
    my_wallet.add_cash(earned)
    my_wallet.spend_cash(spent)
    assert my_wallet.balance == expected
예제 #6
0
def test_wallet_add_cash():
    wallet = Wallet(10)
    wallet.add_cash(90)
    assert wallet.balance == 100
예제 #7
0
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    
예제 #8
0
def test_wallet_add_cash():
    """Testing add_cash method in wallet object"""
    wallet = Wallet(10)
    wallet.add_cash(90)
    assert wallet.balance == 100
예제 #9
0
def test_transactions(earned, spent, expected_balance):
    wallet = Wallet()
    wallet.add_cash(earned)
    wallet.spend_cash(spent)

    assert wallet.balance == expected_balance
예제 #10
0
def test_amount_adding():
    wallet = Wallet(10)
    wallet.add_cash(20)
    assert wallet.balance == 30
예제 #11
0
def add_cash():
    wallet = Wallet(100)
    wallet.add_cash(100)
    assert wallet.balance == 200