def transfer(self, initial_account, final_account, amount): if amount <= 0: raise ValueError("amount must be greater than zero") elif Customer.numAccs() <= 1: raise ValueError("You must have at least 2 accounts") else: self.accountType = initial_account self.withdraw(amount) self.accountType = final_account self.deposit(amount)
def test_threeAccounts(): oscar = Customer("Oscar").openAccount(Account(SAVINGS)) oscar.openAccount(Account(CHECKING)) oscar.openAccount(Account(MAXI_SAVINGS)) assert_equals(oscar.numAccs(), 3)
def test_oneAccount(): oscar = Customer("Oscar").openAccount(Account(SAVINGS)) assert_equals(oscar.numAccs(), 1)
def test_threeAccounts(): oscar = Customer("Oscar").openAccount(SavingsAcc()) oscar.openAccount(CheckingAcc()).openAccount(MaxiSavingsAcc()) assert_equals(oscar.numAccs(), 3)
def test_oneAccount(): oscar = Customer("Oscar").openAccount(SavingsAcc()) assert_equals(oscar.numAccs(), 1)
def test_twoAccounts(self): oscar = Customer("Oscar").openAccount(SavingsAc()) oscar.openAccount(CheckingAc()) assert_equals(oscar.numAccs(), 2)