def test_withdraw(self): # Given account = Account(Decimal(100)) amount = Decimal(10) # When account.withdraw(amount) # Then assert account.balance == Decimal(90)
def test_user_can_withdraw_amount_in_account(self): # Arrange account = Account("Alan", "33") account.balance = 200 expected_result = 100 # Act account.withdraw(100) observed = account.balance # Assert self.assertEqual(observed, expected_result)
def test_user_can_withdraw_amount_not_in_account(self): # Arrange account = Account("Alan", "33") account.balance = 100 expected_result = "Sorry insufficent funds" # Act observed = account.withdraw(101) # Assert self.assertEqual(observed, expected_result)
def testWithdraw(self): greg = Account("Greg") greg.balance = 5002.00 greg.withdraw(5000.00) self.assertEqual(greg.balance, 2.00)