def test_06_one_below_lower_limit_value(self):
     param1 = {('Bob Bob', 786543210): 10.0}
     param2 = [(11, 20)]
     actual = banking_functions.get_financial_range_to_clients(
         param1, param2)
     expected = {}
     msg = "Expected {}, but returned {}".format(expected, actual)
     self.assertEqual(actual, expected, msg)
 def test_00_empty(self):
     param1 = {}
     param2 = [()]
     actual = banking_functions.get_financial_range_to_clients(
         param1, param2)
     expected = {}
     msg = "Expected {}, but returned {}".format(expected, actual)
     self.assertEqual(actual, expected, msg)
 def test_01_one_person_within_one_range(self):
     param1 = {('Bob Bob', 786543210): 10.0}
     param2 = [(0, 100000)]
     actual = banking_functions.get_financial_range_to_clients(
         param1, param2)
     expected = {(0, 100000): [('Bob Bob', 786543210)]}
     msg = "Expected {}, but returned {}".format(expected, actual)
     self.assertEqual(actual, expected, msg)
 def test_02_two_person_within_range(self):
     param1 = {('Bob Bob', 786543210): 10.0, ('Ali Ali', 989090123): 45.0}
     param2 = [(0, 100000), (10, 200)]
     actual = banking_functions.get_financial_range_to_clients(
         param1, param2)
     expected = {
         (0, 100000): [('Bob Bob', 786543210), ('Ali Ali', 989090123)],
         (10, 200): [('Bob Bob', 786543210), ('Ali Ali', 989090123)]
     }
     msg = "Expected {}, but returned {}".format(expected, actual)
     self.assertEqual(actual, expected, msg)
Ejemplo n.º 5
0
print('Checking get_loan_status...')
client_to_accounts = {('Bob Bob', 777777777):[[1.0], [1.0]], ('Carly Dafford', 555555555):[[2.0], [1.5]]}
client_to_total_balance = {('Bob Bob', 777777777): 1.0, ('Carly Dafford', 555555555): 2.0}
result = abc.get_loan_status(client_to_accounts, client_to_total_balance, ('Bob Bob', 777777777), 10.0)

assert isinstance(result, bool), \
       '''abc.get_loan_status should return a bool, but returned {0}
       .'''.format(type(result))
print('  check complete')

# --- get_financial_range_to_clients
print('Checking get_financial_range_to_clients...')
client_to_total_balance = {('Bob Bob', 777777777):1.0, ('Carly Dafford', 555555555):1.0}
financial_ranges = [(0.0, 1.0), (1.5, 2.0)]
result = abc.get_financial_range_to_clients(client_to_total_balance, financial_ranges)

# check the keys and values
for key, value in result.items():
    assert isinstance(key, tuple), \
            '''abc.load_financial_data should return a dict where the keys are 
            tuples, but key {0} is of type {1}.
            '''.format(key, type(key))
    assert isinstance(key[0], float), \
           '''abc.load_financial_data should return a dict where its keys are tuples
            with type float at index 0, but {0} is of type {1}.
           '''.format(key[0], type(key[0]))
    assert isinstance(key[1], float), \
           '''abc.load_financial_data should return a dict where its keys are tuples
            with type float at index 1, but {0} is of type {1}.
           '''.format(key[1], type(key[1]))