Пример #1
0
 def test_deposit_empty(self):
     '''
     Checks that deposit raises an error when no amount is provided
     '''
     with self.assertRaises(TypeError):
         my_account = Customer("Spencer")
         my_account.set_balance()
         my_account.deposit()
Пример #2
0
    def test_deposit(self):
        #set the testing initial balance to 10 dollars.
        Customer.set_balance(sample, balance=10.0)
        prev_balance = sample.balance

        #deposits nothing, the balance should stays the same.
        Customer.deposit(sample, 0)
        self.assertEqual(sample.balance, prev_balance)

        #deposit $10.50 and should be equal to 10.50 + previous balance.
        prev_balance = sample.balance
        Customer.deposit(sample, 10.50)
        self.assertEqual(sample.balance, prev_balance + 10.50)
Пример #3
0
 def test_deposit_function(self):
     '''
     Checks that deposit, when given a proper amount value, functions correctly
     Checks both the modified balance within class and the returned value by deposit
     '''
     this_balance = 19.53
     this_deposit = 3.2
     sample_account = Customer("Michael")
     sample_account.set_balance(this_balance)
     self.assertEqual(sample_account.deposit(this_deposit),
                      this_balance + this_deposit)
     self.assertEqual(sample_account.balance, this_balance + this_deposit)
 def test_deposit(self):
     customerTest = Customer("Testing Customer")
     customerTest.set_balance(4000)
     self.assertEqual(customerTest.deposit(200), 4200)
     self.assertEqual(customerTest.deposit(10), 4210)
     self.assertEqual(customerTest.deposit(400), 4610)