Ejemplo n.º 1
0
 def test_get_food_items_keys(self):
     actual = get_food_items()
     keys = []
     expected = str
     for i in actual.keys():
         keys.append(i)
     for thing in keys:
         self.assertEqual(type(thing), expected)
Ejemplo n.º 2
0
 def test_get_food_items_values(self):
     actual = get_food_items()
     values = []
     expected = int
     for i in actual.values():
         values.append(i)
     for thing in values:
         self.assertEqual(type(thing), expected)
Ejemplo n.º 3
0
 def test_print_result_prints_correctly(self, mock_output):
     food = get_food_items()
     total_test = 12345
     avg_test = 54321.1
     keys = list(food.keys())
     expected = f"\nFood Items: {sorted(keys)}\nTotal Calories: {total_test} Average Calories: {avg_test}\n\n"
     print_result(keys, total_test, avg_test)
     actual = mock_output.getvalue()
     self.assertEqual(expected, actual)
Ejemplo n.º 4
0
 def test_print_result_average_rounds_down(self, mock_output):
     food = get_food_items()
     total_test = 12345
     avg_test = 1.149999999999
     keys = list(food.keys())
     expected = f"\nFood Items: {sorted(keys)}\nTotal Calories: {total_test} Average Calories: 1.1\n\n"
     print_result(keys, total_test, avg_test)
     actual = mock_output.getvalue()
     self.assertEqual(expected, actual)
Ejemplo n.º 5
0
 def test_get_food_items_type(self):
     actual = type(get_food_items())
     expected = dict
     self.assertEqual(actual, expected)