def test_03_zero_interest_rate(self): param = {('Bob Bob', 786543210): [[100.0], [0.0]]} banking_functions.open_savings_account(param, ('Bob Bob', 786543210), 300.0, 3.1) expected = {('Bob Bob', 786543210): [[100.0, 300.0], [0.0, 3.1]]} msg = "Expected {}, but got {}".format(expected, param) self.assertEqual(param, expected, msg)
def test_02_zero_account_balance(self): param = {('Bob Bob', 786543210): [[0.0], [2.0]]} banking_functions.open_savings_account(param, ('Bob Bob', 786543210), 400.0, 1.1) expected = {('Bob Bob', 786543210): [[0.0, 400.0], [2.0, 1.1]]} msg = "Expected {}, but got {}".format(expected, param) self.assertEqual(param, expected, msg)
def test_00_one_person_one_account(self): param = {('Bob Bob', 786543210): [[1.0], [1.5]]} banking_functions.open_savings_account(param, ('Bob Bob', 786543210), 2.0, 1.1) expected = {('Bob Bob', 786543210): [[1.0, 2.0], [1.5, 1.1]]} msg = "Expected {}, but got {}".format(expected, param) self.assertEqual(param, expected, msg)
def test_00_last_account_balance_zero(self): param = {('Bob Bob', 786543210): [[100.0, 54.0, 0.0], [3.0, 0.9, 1.0]]} banking_functions.open_savings_account(param, ('Bob Bob', 786543210), 99.0, 2.8) expected = { ('Bob Bob', 786543210): [[100.0, 54.0, 0.0, 99.0], [3.0, 0.9, 1.0, 2.8]] } msg = "Expected {}, but got {}".format(expected, param) self.assertEqual(param, expected, msg)
def test_01_two_person_two_account(self): param = { ('Bob Bob', 786543210): [[1.0], [1.5]], ('Ali Ali', 786123210): [[5.0], [2.5]] } banking_functions.open_savings_account(param, ('Ali Ali', 786123210), 6.0, 3.1) expected = { ('Bob Bob', 786543210): [[1.0], [1.5]], ('Ali Ali', 786123210): [[5.0, 6.0], [2.5, 3.1]] } msg = "Expected {}, but got {}".format(expected, param) self.assertEqual(param, expected, msg)
'''abc.get_num_accounts should return an int, but returned {0} .'''.format(type(result)) print(' check complete') print('Checking get_account_balance...') client_to_accounts = {('Bob Bob', 777777777):[[1.0], [1.0]], ('Carly Dafford', 555555555):[[2.0], [1.5]]} result = abc.get_account_balance(client_to_accounts, ('Bob Bob', 777777777), 0) assert isinstance(result, float), \ '''abc.get_num_accounts should return a float, but returned {0} .'''.format(type(result)) print(' check complete') print('Checking open_savings_account...') client_to_accounts = {('Bob Bob', 777777777):[[1.0], [1.0]], ('Carly Dafford', 555555555):[[2.0], [1.5]]} result = abc.open_savings_account(client_to_accounts, ('Bob Bob', 777777777), 1.0, 1.0) assert result == None, \ '''abc.get_num_accounts should return None, but returned {0} .'''.format(type(result)) print(' check complete') ## --------- get client to total balance print('Checking get_client_to_total_balance...') client_to_accounts = {('Bob Bob', 777777777):[[1.0], [1.0]], ('Carly Dafford', 555555555):[[2.0], [1.5]]} result = abc.get_client_to_total_balance(client_to_accounts) assert isinstance(result, dict), \ '''abc.get_num_accounts should return dict, but returned {0} .'''.format(type(result)) # check the keys and values for key, value in result.items():