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)
Example #2
0
 def setUp(self):
     self.food_taste = FoodTaste()
     self.food_taste.preferences({
         'item1': 1,
         'item2': 2,
         'item3': 3,
         'item4': 4,
         'item5': 5,
         'item6_part1 item6_part2': 6
     })
Example #3
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))
Example #4
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)
Example #5
0
 def test_no_preferences_configured(self):
     self.food_taste = FoodTaste()
     self.assertEqual(0, self.food_taste.rate('item1'))