def get_forecast_latest_weathers(forecast: Forecast) -> List[Weather]: weathers = {} for weather in forecast.get_weathers(): weather_date = weather.get_reference_time('date').strftime('%Y-%M-%d') weathers[weather_date] = weather return list(weathers.values())
def test_getters_return_expected_daily_data(self): instance = Forecast("daily", self.__test_reception_time, self.__test_location, self.__test_weathers) self.assertEqual(instance.get_interval(), "daily") self.assertEqual(instance.get_reception_time(), self.__test_reception_time) self.assertEqual(instance.get_location(), self.__test_location) self.assertEqual(instance.get_weathers(), self.__test_weathers)
def test_getters_return_expected_3h_data(self): """ Test either for "3h" forecast and "daily" ones """ instance = Forecast("3h", self.__test_reception_time, self.__test_location, self.__test_weathers) self.assertEqual(instance.get_interval(), "3h") self.assertEqual(instance.get_reception_time(), self.__test_reception_time) self.assertEqual(instance.get_location(), self.__test_location) self.assertEqual(instance.get_weathers(), self.__test_weathers)