def test_make_loop_back_payment(): """ Money transfer from wallet to the same wallet """ test_wallet = Wallet(10) test_wallet.make_payment(test_wallet, 20) assert test_wallet.balance() == 10
def test_make_payment_more_that_wallet(): """ Wrong payment value more that wallet balance """ first_wallet = Wallet(10) second_wallet = Wallet(2) second_wallet.make_payment(first_wallet, 5) assert second_wallet.balance() >= 0
def test_make_payment(): """ Make simple transaction """ first_wallet = Wallet(10) second_wallet = Wallet(2) second_wallet.make_payment(first_wallet, 2) assert second_wallet.balance() == 0
def test_cross_params(wallet_a, wallet_b): """ Cross-test of payment method for several test data sets """ first_wallet = Wallet(wallet_a) second_wallet = Wallet(wallet_b) first_wallet.make_payment(second_wallet, wallet_b) assert first_wallet.balance() == (wallet_a - wallet_b) assert second_wallet.balance() == (wallet_b + wallet_b)
def test_make_some_transfer(wallet_a, amount, wallet_b, expected): """ Method for transfer money tests First wallet amount Transfer amount Second wallet initial value Expected second wallet amount """ first_wallet = Wallet(wallet_a) second_wallet = Wallet(wallet_b) first_wallet.make_payment(second_wallet, amount) assert second_wallet.balance() == expected
def test_make_wrong_payment_amount(): """ Wrong argument for payment method """ first_wallet = Wallet(10) second_wallet = Wallet(2) try: second_wallet.make_payment(first_wallet, 'asd') except TypeError: assert False finally: assert False