コード例 #1
0
	def testWithdrawalTransaction(self):
		account = BankAccount(1)
		account.balance = 10
		account.withdraw(5)
		self.assertEqual(len(account.transactions),1)
コード例 #2
0
	def testDepositTransactionType(self):
		account = BankAccount(1)
		account.deposit(10)
		self.assertIsInstance(account.transactions[0],Transaction)
コード例 #3
0
	def testGetBalanceAccuracy(self):
		account = BankAccount(1)
		account.balance = 10
		self.assertEqual(account.getBalance(),10)
コード例 #4
0
	def testDepositTransaction(self):
		account = BankAccount(1)
		account.deposit(10)
		self.assertEqual(len(account.transactions),1)
コード例 #5
0
	def testOverdraft(self):
		account = BankAccount(1)
		account.balance = 10
		self.assertRaises(Exception, account.withdraw,11)
コード例 #6
0
	def testSmallWithdraw(self):
		account = BankAccount(1)
		account.balance = 10
		account.withdraw(0.001)
		self.assertEqual(account.balance,9.999)
コード例 #7
0
	def testNegativeWithdraw(self):
		account = BankAccount(1)
		account.balance = 10
		self.assertRaises(Exception, account.withdraw,-5)
コード例 #8
0
	def testIntegerDeposit(self):
		account = BankAccount(1)
		account.balance = 10
		account.deposit(10)
		self.assertEqual(account.balance,20)
コード例 #9
0
	def testSmallDeposit(self):
		account = BankAccount(1)
		account.balance = 10
		account.deposit(0.001)
		self.assertEqual(account.balance,10.001)
コード例 #10
0
	def testIntegerWithdraw(self):
		account = BankAccount(1)
		account.balance = 10
		account.withdraw(5)
		self.assertEqual(account.balance,5)
コード例 #11
0
	def testLargeDeposit(self):
		account = BankAccount(1)
		account.balance = 10
		account.deposit(2147483650)
		self.assertEqual(account.balance,2147483660)
コード例 #12
0
	def testDecimalDeposit(self):
		account = BankAccount(1)
		account.balance = 10
		account.deposit(0.50)
		self.assertEqual(account.balance,10.50)
コード例 #13
0
	def testNegativeDeposit(self):
		account = BankAccount(1)
		account.balance = 10
		self.assertRaises(Exception, account.deposit,-10)
コード例 #14
0
	def testWithdrawalTransactionType(self):
		account = BankAccount(1)
		account.balance = 10
		account.withdraw(5)
		self.assertIsInstance(account.transactions[0],Transaction)
コード例 #15
0
	def testDecimalWithdraw(self):
		account = BankAccount(1)
		account.balance = 10
		account.withdraw(0.50)
		self.assertEqual(account.balance,9.50)
コード例 #16
0
	def testExceptionTransaction(self):
		account = BankAccount(1)
		self.assertRaises(Exception, account.withdraw,11)
		self.assertIsInstance(account.transactions[0],Transaction)
コード例 #17
0
ファイル: testThis.py プロジェクト: vinyaa/assignment2
	def test3(self):
		b2 = BankAccount(4)
		self.assertEqual(b2.getAccountNumber(),4)