def setUp(self):
     self.cafes = copy.deepcopy(CAFES)
     self.taste = FoodTaste().preferences(FOOD_PREFERENCES)
     self.weather_opinion = WeatherOpinion().weather(self.GOOD_WEATHER)
     self.clo = ChiefLunchOfficer(food_taste=self.taste,
                                  weather_opinion=self.weather_opinion)
     self.clo.cafes(self.cafes)
 def setUp(self):
     self.taste = FoodTaste().preferences({})
     self.weather = WeatherOpinion()
     self.weather.is_positive = Mock(return_value=True)
     self.clo = ChiefLunchOfficer(food_taste=self.taste, weather_opinion=self.weather)
class ChiefLunchOfficerTest(unittest.TestCase):

    def setUp(self):
        self.taste = FoodTaste().preferences({})
        self.weather = WeatherOpinion()
        self.weather.is_positive = Mock(return_value=True)
        self.clo = ChiefLunchOfficer(food_taste=self.taste, weather_opinion=self.weather)

    def test_if_only_one_cafe_to_choose_from_it_is_chosen(self):
        self.clo.cafes({
          'cafe1': {
            'menu': 'food'
          }
        })
        self.assertEqual('cafe1', self.clo.decide_one())

    def test_if_all_same_but_one_cafe_has_better_rating_it_is_chosen(self):

        def rate(menu):
            ratings = {
                'good_food': 2,
                'excellent_food': 3,
                'some_food': 1
            }
            return ratings[menu]

        self.taste.rate = Mock(side_effect=rate)
        self.clo.cafes({
          'cafe1': {
            'menu': 'good_food',
            'distance': 1
          },
          'cafe2': {
            'menu': 'excellent_food',
            'distance': 1
          },
          'cafe3': {
            'menu': 'some_food',
            'distance': 1
          }
        })
        self.assertEqual(['cafe2', 'cafe1', 'cafe3'], self.clo.decide())

    def test_if_all_same_and_bad_weather_then_cafe_with_shortest_distance_is_chosen(self):
        self.taste.rate = Mock(return_value=0)
        self.weather.is_positive = Mock(return_value=False)
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 2
          },
          'cafe2': {
            'menu': 'food2',
            'distance': 3
          },
          'cafe3': {
            'menu': 'food3',
            'distance': 1
          }
        })
        self.assertEqual(['cafe3', 'cafe1', 'cafe2'], self.clo.decide())

    def test_if_all_same_but_history_not_visited_cafe_is_preferred(self):
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1
          },
          'cafe2': {
            'menu': 'food2',
            'distance': 1
          },
          'cafe3': {
            'menu': 'food3',
            'distance': 1
          }
        })
        self.clo.lunched(['cafe2', 'cafe3', 'cafe3', 'cafe1', 'cafe1', 'cafe1'])
        self.assertEqual(['cafe2', 'cafe3', 'cafe1'], self.clo.decide())

    def test_if_all_same_choose_cafe_with_higher_rating(self):
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1,
            'rating': 2
          },
          'cafe2': {
            'menu': 'food2',
            'distance': 1,
            'rating': 3
          },
          'cafe3': {
            'menu': 'food3',
            'distance': 1,
            'rating': 1
          }
        })
        self.clo.lunched([])
        self.assertEqual(['cafe2', 'cafe1', 'cafe3'], self.clo.decide())

    def test_if_all_same_and_some_cafe_preferred_on_this_weekday_choose_this_cafe(self):
        self.clo.weekday(4)
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1,
            'preferred_weekdays': [3]
          },
          'cafe2': {
            'menu': 'food2',
            'distance': 1,
            'preferred_weekdays': [4]
          }
        })
        self.assertEqual(['cafe2', 'cafe1'], self.clo.decide())
        self.clo.cafes({
          'cafe2': {
            'menu': 'food2',
            'distance': 1
          },
          'cafe3': {
            'menu': 'food3',
            'distance': 1,
            'preferred_weekdays': [4]
          }
        })
        self.assertEqual(['cafe3', 'cafe2'], self.clo.decide())

    def test_if_some_cafe_is_closed_then_do_not_choose_this_cafe(self):
        self.clo.weekday(5)
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1,
            'closed_weekdays': [5, 6]
          },
          'cafe2': {
            'menu': 'food2',
            'distance': 1
          }
        })
        self.assertEqual(['cafe2'], self.clo.decide())
        self.clo.weekday(4)
        self.assertEqual({'cafe1', 'cafe2'}, set(self.clo.decide()))

    def test_if_some_cafe_configured_as_once_per_week_and_already_went_there_then_skip_it(self):
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1,
            'once_per_week': True
          },
          'cafe2': {
            'menu': 'food2',
            'distance': 1
          }
        })
        self.clo.lunched([])
        self.assertEqual({'cafe1', 'cafe2'}, set(self.clo.decide()))
        self.clo.lunched(['cafe1', 'cafe2'])
        self.assertEqual({'cafe2'}, set(self.clo.decide()))

    def test_if_no_weather_opinion_then_still_decide(self):
        self.weather.is_positive = Mock(return_value=None)
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1
          }
        })
        self.assertEqual(['cafe1'], self.clo.decide())

    def test_if_no_cafes_provided_then_empty_list(self):
        self.clo.cafes({})
        self.assertEqual([], self.clo.decide())
        self.assertEqual('No idea', self.clo.decide_one())

    def test_if_no_history_provided_then_empty_list(self):
        self.clo.lunched([])
        self.clo.cafes({
          'cafe1': {
            'menu': 'food1',
            'distance': 1
          }
        })
        self.assertEqual(['cafe1'], self.clo.decide())

    def test_if_no_cafes_provided_then_empty_list(self):
        self.clo.cafes({}).lunched([]).weather(None).weekday(None)
        self.assertEqual([], self.clo.decide())
        self.assertEqual('No idea', self.clo.decide_one())
print('\nPihka:\n\n%s' % make_readable(pihka_menu, collapse_whitespace=True))
factory_salmisaari_menu = get_factory_salmisaari_menu(today)
print('\nFactory Salmisaari:\n\n%s' % make_readable(factory_salmisaari_menu, insert_new_lines=False))

weather = get_todays_weather()
print('\nWeather:\n\n temperature %s C\n chance of precipitation %s percent\n precipitation amount %s mm\n wind %s m/s' % (weather[TEMPERATURE], weather[PRECIPITATION_CHANCE], weather[PRECIPITATION_AMOUNT], weather[WIND]))

lunch_history = get_current_week_history(today)
current_week_cafes = ordered_cafes(lunch_history)
print('\nLunch history for current week:\n\n %s' % ', '.join(current_week_cafes))

cafes = deepcopy(CAFES)
cafes[SODEXO_EXPLORER]['menu'] = sodexo_explorer_menu
cafes[SODEXO_ACQUA]['menu'] = sodexo_acqua_menu
cafes[ANTELL]['menu'] = antell_menu
cafes[HIMA_SALI]['menu'] = hima_sali_menu
cafes[DYLAN_MILK]['menu'] = dylan_milk_menu
cafes[PIHKA]['menu'] = pihka_menu
cafes[FACTORY_SALMISAARI]['menu'] = factory_salmisaari_menu

food_taste = FoodTaste().preferences(FOOD_PREFERENCES)
weather_opinion = WeatherOpinion().weather(weather)
clo = ChiefLunchOfficer(food_taste=food_taste, weather_opinion=weather_opinion)
clo.lunched(current_week_cafes).weather(weather).cafes(cafes).weekday(today.weekday())
todays_cafes = clo.decide()
todays_cafe = todays_cafes[0]
todays_cafe_address = CAFES[todays_cafe]['address']
update_history(lunch_history, today, todays_cafe)
print('\nRecommendation:\n\n %s, %s' % (todays_cafe, todays_cafe_address))
formatted_cafes = ', '.join(todays_cafes[0:5]) + '\n' + ', '.join(todays_cafes[5:-1])
print('\nAll lunch in preferred order:\n\n %s' % (formatted_cafes))
Exemple #5
0
    '\nWeather:\n\n temperature %s C\n chance of precipitation %s percent\n precipitation amount %s mm\n wind %s m/s'
    % (weather[TEMPERATURE], weather[PRECIPITATION_CHANCE],
       weather[PRECIPITATION_AMOUNT], weather[WIND]))

lunch_history = get_current_week_history(today)
current_week_cafes = ordered_cafes(lunch_history)
print('\nLunch history for current week:\n\n %s' %
      ', '.join(current_week_cafes))

cafes = deepcopy(CAFES)
cafes[SODEXO_EXPLORER]['menu'] = sodexo_explorer_menu
cafes[SODEXO_ACQUA]['menu'] = sodexo_acqua_menu
cafes[ANTELL]['menu'] = antell_menu
cafes[HIMA_SALI]['menu'] = hima_sali_menu
cafes[DYLAN_MILK]['menu'] = dylan_milk_menu
cafes[PIHKA]['menu'] = pihka_menu
cafes[FACTORY_SALMISAARI]['menu'] = factory_salmisaari_menu

food_taste = FoodTaste().preferences(FOOD_PREFERENCES)
weather_opinion = WeatherOpinion().weather(weather)
clo = ChiefLunchOfficer(food_taste=food_taste, weather_opinion=weather_opinion)
clo.lunched(current_week_cafes).weather(weather).cafes(cafes).weekday(
    today.weekday())
todays_cafes = clo.decide()
todays_cafe = todays_cafes[0]
todays_cafe_address = CAFES[todays_cafe]['address']
update_history(lunch_history, today, todays_cafe)
print('\nRecommendation:\n\n %s, %s' % (todays_cafe, todays_cafe_address))
formatted_cafes = ', '.join(todays_cafes[0:5]) + '\n' + ', '.join(
    todays_cafes[5:-1])
print('\nAll lunch in preferred order:\n\n %s' % (formatted_cafes))
Exemple #6
0
 def setUp(self):
     self.taste = FoodTaste().preferences({})
     self.weather = WeatherOpinion()
     self.weather.is_positive = Mock(return_value=True)
     self.clo = ChiefLunchOfficer(food_taste=self.taste,
                                  weather_opinion=self.weather)
Exemple #7
0
class ChiefLunchOfficerTest(unittest.TestCase):
    def setUp(self):
        self.taste = FoodTaste().preferences({})
        self.weather = WeatherOpinion()
        self.weather.is_positive = Mock(return_value=True)
        self.clo = ChiefLunchOfficer(food_taste=self.taste,
                                     weather_opinion=self.weather)

    def test_if_only_one_cafe_to_choose_from_it_is_chosen(self):
        self.clo.cafes({'cafe1': {'menu': 'food'}})
        self.assertEqual('cafe1', self.clo.decide_one())

    def test_if_all_same_but_one_cafe_has_better_rating_it_is_chosen(self):
        def rate(menu):
            ratings = {'good_food': 2, 'excellent_food': 3, 'some_food': 1}
            return ratings[menu]

        self.taste.rate = Mock(side_effect=rate)
        self.clo.cafes({
            'cafe1': {
                'menu': 'good_food',
                'distance': 1
            },
            'cafe2': {
                'menu': 'excellent_food',
                'distance': 1
            },
            'cafe3': {
                'menu': 'some_food',
                'distance': 1
            }
        })
        self.assertEqual(['cafe2', 'cafe1', 'cafe3'], self.clo.decide())

    def test_if_all_same_and_bad_weather_then_cafe_with_shortest_distance_is_chosen(
            self):
        self.taste.rate = Mock(return_value=0)
        self.weather.is_positive = Mock(return_value=False)
        self.clo.cafes({
            'cafe1': {
                'menu': 'food1',
                'distance': 2
            },
            'cafe2': {
                'menu': 'food2',
                'distance': 3
            },
            'cafe3': {
                'menu': 'food3',
                'distance': 1
            }
        })
        self.assertEqual(['cafe3', 'cafe1', 'cafe2'], self.clo.decide())

    def test_if_all_same_but_history_not_visited_cafe_is_preferred(self):
        self.clo.cafes({
            'cafe1': {
                'menu': 'food1',
                'distance': 1
            },
            'cafe2': {
                'menu': 'food2',
                'distance': 1
            },
            'cafe3': {
                'menu': 'food3',
                'distance': 1
            }
        })
        self.clo.lunched(
            ['cafe2', 'cafe3', 'cafe3', 'cafe1', 'cafe1', 'cafe1'])
        self.assertEqual(['cafe2', 'cafe3', 'cafe1'], self.clo.decide())

    def test_if_all_same_and_some_cafe_preferred_on_this_weekday_choose_this_cafe(
            self):
        self.clo.weekday(4)
        self.clo.cafes({
            'cafe1': {
                'menu': 'food1',
                'distance': 1,
                'preferred_weekdays': [3]
            },
            'cafe2': {
                'menu': 'food2',
                'distance': 1,
                'preferred_weekdays': [4]
            }
        })
        self.assertEqual(['cafe2', 'cafe1'], self.clo.decide())
        self.clo.cafes({
            'cafe2': {
                'menu': 'food2',
                'distance': 1
            },
            'cafe3': {
                'menu': 'food3',
                'distance': 1,
                'preferred_weekdays': [4]
            }
        })
        self.assertEqual(['cafe3', 'cafe2'], self.clo.decide())

    def test_if_some_cafe_is_closed_then_do_not_choose_this_cafe(self):
        self.clo.weekday(5)
        self.clo.cafes({
            'cafe1': {
                'menu': 'food1',
                'distance': 1,
                'closed_weekdays': [5, 6]
            },
            'cafe2': {
                'menu': 'food2',
                'distance': 1
            }
        })
        self.assertEqual(['cafe2'], self.clo.decide())
        self.clo.weekday(4)
        self.assertEqual({'cafe1', 'cafe2'}, set(self.clo.decide()))

    def test_if_some_cafe_configured_as_once_per_week_and_already_went_there_then_skip_it(
            self):
        self.clo.cafes({
            'cafe1': {
                'menu': 'food1',
                'distance': 1,
                'once_per_week': True
            },
            'cafe2': {
                'menu': 'food2',
                'distance': 1
            }
        })
        self.clo.lunched([])
        self.assertEqual({'cafe1', 'cafe2'}, set(self.clo.decide()))
        self.clo.lunched(['cafe1', 'cafe2'])
        self.assertEqual({'cafe2'}, set(self.clo.decide()))

    def test_if_no_weather_opinion_then_still_decide(self):
        self.weather.is_positive = Mock(return_value=None)
        self.clo.cafes({'cafe1': {'menu': 'food1', 'distance': 1}})
        self.assertEqual(['cafe1'], self.clo.decide())

    def test_if_no_cafes_provided_then_empty_list(self):
        self.clo.cafes({})
        self.assertEqual([], self.clo.decide())
        self.assertEqual('No idea', self.clo.decide_one())

    def test_if_no_history_provided_then_empty_list(self):
        self.clo.lunched([])
        self.clo.cafes({'cafe1': {'menu': 'food1', 'distance': 1}})
        self.assertEqual(['cafe1'], self.clo.decide())

    def test_if_no_cafes_provided_then_empty_list(self):
        self.clo.cafes({}).lunched([]).weather(None).weekday(None)
        self.assertEqual([], self.clo.decide())
        self.assertEqual('No idea', self.clo.decide_one())
class ChiefLunchOfficerIntegrationTest(unittest.TestCase):

    BAD_WEATHER = {
        TEMPERATURE: -30,
        PRECIPITATION_CHANCE: 10,
        PRECIPITATION_AMOUNT: 2.0,
        WIND: 10
    }

    GOOD_WEATHER = {
        TEMPERATURE: 23,
        PRECIPITATION_CHANCE: 0,
        PRECIPITATION_AMOUNT: 0.0,
        WIND: 5
    }

    def setUp(self):
        self.cafes = copy.deepcopy(CAFES)
        self.taste = FoodTaste().preferences(FOOD_PREFERENCES)
        self.weather_opinion = WeatherOpinion().weather(self.GOOD_WEATHER)
        self.clo = ChiefLunchOfficer(food_taste=self.taste,
                                     weather_opinion=self.weather_opinion)
        self.clo.cafes(self.cafes)

    def test_if_bad_weather_go_to_hima_sali_or_sodexo(self):
        self.cafes[HIMA_SALI]['menu'] = 'green salad'
        self.cafes[DYLAN_MILK]['menu'] = 'meatballs'
        self.weather_opinion.weather(self.BAD_WEATHER)
        clo_choice = self.clo.decide_one()
        self.assertEqual(
            True, HIMA_SALI == clo_choice or SODEXO_ACQUA == clo_choice
            or SODEXO_EXPLORER == clo_choice)

    def test_if_one_cafe_one_day_another_next_day(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'meat'
        self.clo.lunched([HIMA_SALI])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_if_meatballs_dylan_milk_can_occur_twice_in_a_week(self):
        self.cafes[DYLAN_MILK]['menu'] = 'meatballs'
        self.cafes[FACTORY_SALMISAARI]['menu'] = 'fish'
        self.clo.lunched([DYLAN_MILK])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_if_meatballs_hima_sali_can_occur_three_times_in_a_week(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'green salad'
        self.clo.lunched([HIMA_SALI, HIMA_SALI])
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_even_if_meatballs_hima_sali_cannot_occur_four_times_in_a_week(
            self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.lunched([HIMA_SALI, HIMA_SALI, HIMA_SALI])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_if_already_visited_nepalese_this_week_then_some_another_cafe(
            self):
        self.clo.lunched([NEPALESE])
        self.assertTrue(NEPALESE not in self.clo.decide())

    def test_if_wed_and_nothing_interesting_on_others_menu_then_nepalese_if_not_visited_it(
            self):
        self.cafes[HIMA_SALI]['menu'] = 'fish'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(2)
        self.assertEqual(NEPALESE, self.clo.decide_one())

    def test_if_wed_and_nothing_interesting_on_others_menu_and_bad_weather_then_hima_sali(
            self):
        self.cafes[HIMA_SALI]['menu'] = 'fish'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(2)
        self.weather_opinion.weather(self.BAD_WEATHER)
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_if_wed_and_nothing_interesting_on_others_menu_then_nepalese_if_not_visited_it(
            self):
        self.cafes[HIMA_SALI]['menu'] = 'fish'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(4)
        self.assertEqual(NEPALESE, self.clo.decide_one())

    def test_if_thu_and_pea_soup_then_factory_salmisaari_even_if_lunched_2_times_there_this_week(
            self):
        self.cafes[FACTORY_SALMISAARI]['menu'] = 'pea soup'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(3)
        self.clo.lunched([FACTORY_SALMISAARI, FACTORY_SALMISAARI])
        self.assertEqual(FACTORY_SALMISAARI, self.clo.decide_one())

    def test_if_thu_then_not_hima_sali_if_lunched_3_times_there_this_week(
            self):
        self.cafes[HIMA_SALI]['menu'] = 'pea soup'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(3)
        self.clo.lunched([HIMA_SALI, HIMA_SALI, HIMA_SALI])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_pea_soup_over_meatballs(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'pea soup'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_meatballs_over_meat(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'meat'
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_prefer_meat_over_chicken(self):
        self.cafes[HIMA_SALI]['menu'] = 'chicken'
        self.cafes[DYLAN_MILK]['menu'] = 'meat'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_fish_over_chicken_if_fish_at_a_better_rated_cafe(self):
        self.cafes[HIMA_SALI]['menu'] = 'chicken'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_chicken_over_fish(self):
        self.cafes[FACTORY_SALMISAARI]['menu'] = 'chicken'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.assertEqual(FACTORY_SALMISAARI, self.clo.decide_one())

    def test_prefer_fish_over_everything_remaining(self):
        self.cafes[HIMA_SALI]['menu'] = 'brocolli'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())
class ChiefLunchOfficerIntegrationTest(unittest.TestCase):

    BAD_WEATHER = {
        TEMPERATURE: -30,
        PRECIPITATION_CHANCE: 10,
        PRECIPITATION_AMOUNT: 2.0,
        WIND: 10
    }

    GOOD_WEATHER = {
        TEMPERATURE: 23,
        PRECIPITATION_CHANCE: 0,
        PRECIPITATION_AMOUNT: 0.0,
        WIND: 5
    }

    def setUp(self):
        self.cafes = copy.deepcopy(CAFES)
        self.taste = FoodTaste().preferences(FOOD_PREFERENCES)
        self.weather_opinion = WeatherOpinion().weather(self.GOOD_WEATHER)
        self.clo = ChiefLunchOfficer(food_taste=self.taste, weather_opinion=self.weather_opinion)
        self.clo.cafes(self.cafes)

    def test_if_bad_weather_go_to_hima_sali(self):
        self.cafes[HIMA_SALI]['menu'] = 'green salad'
        self.cafes[DYLAN_MILK]['menu'] = 'meatballs'
        self.weather_opinion.weather(self.BAD_WEATHER)
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_if_one_cafe_one_day_another_next_day(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'meat'
        self.clo.lunched([HIMA_SALI])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_if_meatballs_hima_sali_can_occur_twice_in_a_week(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.lunched([HIMA_SALI])
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_if_meatballs_hima_sali_can_occur_three_times_in_a_week(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'green salad'
        self.clo.lunched([HIMA_SALI, HIMA_SALI])
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_even_if_meatballs_hima_sali_cannot_occur_four_times_in_a_week(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.lunched([HIMA_SALI, HIMA_SALI, HIMA_SALI])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_if_already_visited_nepalese_this_week_then_some_another_cafe(self):
        self.clo.lunched([NEPALESE])
        self.assertTrue(NEPALESE not in self.clo.decide())

    def test_if_wed_and_nothing_interesting_on_others_menu_then_nepalese_if_not_visited_it(self):
        self.cafes[HIMA_SALI]['menu'] = 'fish'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(2)
        self.assertEqual(NEPALESE, self.clo.decide_one())

    def test_if_wed_and_nothing_interesting_on_others_menu_and_bad_weather_then_hima_sali(self):
        self.cafes[HIMA_SALI]['menu'] = 'fish'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(2)
        self.weather_opinion.weather(self.BAD_WEATHER)
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_if_wed_and_nothing_interesting_on_others_menu_then_nepalese_if_not_visited_it(self):
        self.cafes[HIMA_SALI]['menu'] = 'fish'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(4)
        self.assertEqual(NEPALESE, self.clo.decide_one())

    def test_if_thu_then_hima_sali_even_if_lunched_2_times_there_this_week(self):
        self.cafes[HIMA_SALI]['menu'] = 'pea soup'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(3)
        self.clo.lunched([HIMA_SALI, HIMA_SALI])
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_if_thu_then_not_hima_sali_if_lunched_3_times_there_this_week(self):
        self.cafes[HIMA_SALI]['menu'] = 'pea soup'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.clo.weekday(3)
        self.clo.lunched([HIMA_SALI, HIMA_SALI, HIMA_SALI])
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_pea_soup_over_meatballs(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'pea soup'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_meatballs_over_meat(self):
        self.cafes[HIMA_SALI]['menu'] = 'meatballs'
        self.cafes[DYLAN_MILK]['menu'] = 'meat'
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_prefer_meat_over_chicken(self):
        self.cafes[HIMA_SALI]['menu'] = 'chicken'
        self.cafes[DYLAN_MILK]['menu'] = 'meat'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())

    def test_prefer_chicken_over_fish(self):
        self.cafes[HIMA_SALI]['menu'] = 'chicken'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.assertEqual(HIMA_SALI, self.clo.decide_one())

    def test_prefer_fish_over_everything_remaining(self):
        self.cafes[HIMA_SALI]['menu'] = 'brocolli'
        self.cafes[DYLAN_MILK]['menu'] = 'fish'
        self.assertEqual(DYLAN_MILK, self.clo.decide_one())
 def setUp(self):
     self.cafes = copy.deepcopy(CAFES)
     self.taste = FoodTaste().preferences(FOOD_PREFERENCES)
     self.weather_opinion = WeatherOpinion().weather(self.GOOD_WEATHER)
     self.clo = ChiefLunchOfficer(food_taste=self.taste, weather_opinion=self.weather_opinion)
     self.clo.cafes(self.cafes)