def get_resume(self): return { "weather_condition": self.__scrapy.get_weather_condition(), "maximum_temperature": temperature(self.__scrapy.get_maximum_temperature()), "minimum_temperature": temperature(self.__scrapy.get_minimum_temperature()), "sun_rise": self.__scrapy.get_sun_rise(), "sun_down": self.__scrapy.get_sun_down(), "rain_probability": rain_probability(self.__scrapy.get_rain_probability().replace( '%', '')) }
def __get_hourly_model(self, forecast): return { "weather_condition": forecast[0]['weather'][0]['id'], "current_weather": temperature(forecast[0]['main']['temp']), "maximum_temperature": temperature(self.__get_max(forecast)), "minimum_temperature": temperature(self.__get_min(forecast)), "sun_rise": None, "sun_down": None, "rain_probability": rain_probability(self.__get_rain_probability(forecast)) }
def test_rain_probability_negative_float(self): self.assertEqual(0, rain_probability(-1.1))
def test_rain_probability_negative_integer(self): self.assertEqual(0, rain_probability(-1))
def test_rain_probability_in_interval_string(self): self.assertEqual(0.54121, rain_probability('54.121'))
def test_rain_probability_in_interval_float(self): self.assertEqual(0.1234, rain_probability(12.34))
def test_rain_probability_in_interval_integer(self): self.assertEqual(.12, rain_probability(12))
def test_rain_probability_string_not_digit(self): self.assertEqual(0, rain_probability('aaaaaa1212'))
def test_rain_probability_over_100_string(self): self.assertEqual(0, rain_probability('101'))
def test_rain_probability_over_100_float(self): self.assertEqual(0, rain_probability(101.1))
def test_rain_probability_over_100_integer(self): self.assertEqual(0, rain_probability(101))
def test_rain_probability_negative_string(self): self.assertEqual(0, rain_probability('-1'))