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