def testWithdrawalTransaction(self): account = BankAccount(1) account.balance = 10 account.withdraw(5) self.assertEqual(len(account.transactions),1)
def testWithdrawalTransactionType(self): account = BankAccount(1) account.balance = 10 account.withdraw(5) self.assertIsInstance(account.transactions[0],Transaction)
def testSmallWithdraw(self): account = BankAccount(1) account.balance = 10 account.withdraw(0.001) self.assertEqual(account.balance,9.999)
def testGetBalanceAccuracy(self): account = BankAccount(1) account.balance = 10 self.assertEqual(account.getBalance(),10)
def testDecimalWithdraw(self): account = BankAccount(1) account.balance = 10 account.withdraw(0.50) self.assertEqual(account.balance,9.50)
def testOverdraft(self): account = BankAccount(1) account.balance = 10 self.assertRaises(Exception, account.withdraw,11)
def testIntegerWithdraw(self): account = BankAccount(1) account.balance = 10 account.withdraw(5) self.assertEqual(account.balance,5)
def testNegativeWithdraw(self): account = BankAccount(1) account.balance = 10 self.assertRaises(Exception, account.withdraw,-5)
def testSmallDeposit(self): account = BankAccount(1) account.balance = 10 account.deposit(0.001) self.assertEqual(account.balance,10.001)
def testLargeDeposit(self): account = BankAccount(1) account.balance = 10 account.deposit(2147483650) self.assertEqual(account.balance,2147483660)
def testDecimalDeposit(self): account = BankAccount(1) account.balance = 10 account.deposit(0.50) self.assertEqual(account.balance,10.50)
def testNegativeDeposit(self): account = BankAccount(1) account.balance = 10 self.assertRaises(Exception, account.deposit,-10)
def testIntegerDeposit(self): account = BankAccount(1) account.balance = 10 account.deposit(10) self.assertEqual(account.balance,20)