def main(): running = True while running: customer_info = dict() print "Get a customer's scoring" print "Leave blank if unknown" raw_income = raw_input("Enter the customer's anual income in USD: ") if raw_income != '': customer_info['income'] = raw_income raw_zipcode = raw_input("And their zipcode: ") if raw_zipcode != '': customer_info['zipcode'] = raw_zipcode raw_age = raw_input("Finaly their age: ") if raw_age != '': customer_info['age'] = raw_age customer_scoring = not_real.get_customer_scoring(customer_info) print(customer_scoring) go_again = raw_input('Continue? (Y/N) ').lower() if 'y' in go_again: running = True else: running = False
def test_get_customer_scoring_with_a_dict(self): dict_of_opts = {'income': 60000, 'zipcode': 60626, 'age': 27} results_w_dict = not_real.get_customer_scoring(dict_of_opts) self.assertNotEqual(results_w_dict, None) self.assertIsInstance(results_w_dict, dict) self.assertTrue('propensity' in results_w_dict) self.assertTrue('ranking' in results_w_dict) self.assertEqual(results_w_dict['ranking'], 'C')
def test_get_customer_scoring_with_one_arguments(self): income = 60000 results_w_one = not_real.get_customer_scoring(income) self.assertNotEqual(results_w_one, None) self.assertIsInstance(results_w_one, dict) self.assertTrue('propensity' in results_w_one) self.assertTrue('ranking' in results_w_one) self.assertEqual(results_w_one['ranking'], 'C')
def test_get_customer_scoring_with_two_arguments(self): income = 60000 zipcode = 60626 results_w_two = not_real.get_customer_scoring(income, zipcode) self.assertNotEqual(results_w_two, None) self.assertIsInstance(results_w_two, dict) self.assertTrue('propensity' in results_w_two) self.assertTrue('ranking' in results_w_two) self.assertEqual(results_w_two['ranking'], 'C')
def test_get_customer_scoring_with_too_many_arguments(self): income = 60000 zipcode = 60626 age = 27 results = not_real.get_customer_scoring(income, zipcode, age, 4, 5, 'taco') self.assertNotEqual(results, None) self.assertIsInstance(results, dict) self.assertTrue('propensity' in results) self.assertTrue('ranking' in results) self.assertEqual(results['ranking'], 'C')
def test_get_customer_scoring_with_keyword_argmuents(self): i = 60000 # prevent naming colisions z = 60626 a = 27 results_w_kwargs = not_real.get_customer_scoring(income=i, zipcode=z, age=a) self.assertNotEqual(results_w_kwargs, None) self.assertIsInstance(results_w_kwargs, dict) self.assertTrue('propensity' in results_w_kwargs) self.assertTrue('ranking' in results_w_kwargs) self.assertEqual(results_w_kwargs['ranking'], 'C')
def test_get_customer_scroing_without_arguments(self): results = not_real.get_customer_scoring() self.assertEqual(results, None)