Exemplo n.º 1
0
 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))
     }
Exemplo n.º 3
0
 def test_rain_probability_negative_float(self):
     self.assertEqual(0, rain_probability(-1.1))
Exemplo n.º 4
0
 def test_rain_probability_negative_integer(self):
     self.assertEqual(0, rain_probability(-1))
Exemplo n.º 5
0
 def test_rain_probability_in_interval_string(self):
     self.assertEqual(0.54121, rain_probability('54.121'))
Exemplo n.º 6
0
 def test_rain_probability_in_interval_float(self):
     self.assertEqual(0.1234, rain_probability(12.34))
Exemplo n.º 7
0
 def test_rain_probability_in_interval_integer(self):
     self.assertEqual(.12, rain_probability(12))
Exemplo n.º 8
0
 def test_rain_probability_string_not_digit(self):
     self.assertEqual(0, rain_probability('aaaaaa1212'))
Exemplo n.º 9
0
 def test_rain_probability_over_100_string(self):
     self.assertEqual(0, rain_probability('101'))
Exemplo n.º 10
0
 def test_rain_probability_over_100_float(self):
     self.assertEqual(0, rain_probability(101.1))
Exemplo n.º 11
0
 def test_rain_probability_over_100_integer(self):
     self.assertEqual(0, rain_probability(101))
Exemplo n.º 12
0
 def test_rain_probability_negative_string(self):
     self.assertEqual(0, rain_probability('-1'))