def test_filter_by_status(self): result_1 = weatherutils.filter_by_status(self.__test_weathers, "rain", self.__test_registry) self.assertEqual(1, len(result_1)) self.assertTrue( weatherutils.status_is(result_1[0], "rain", self.__test_registry)) result_2 = weatherutils.filter_by_status(self.__test_weathers, "sun", self.__test_registry) self.assertEqual(1, len(result_2)) self.assertTrue( weatherutils.status_is(result_2[0], "sun", self.__test_registry))
def test_filter_by_status(self): result_1 = weatherutils.filter_by_status(self.__test_weathers, "rain", self.__test_registry) self.assertEqual(1, len(result_1)) self.assertTrue(weatherutils.status_is(result_1[0], "rain", self.__test_registry)) result_2 = weatherutils.filter_by_status(self.__test_weathers, "sun", self.__test_registry) self.assertEqual(1, len(result_2)) self.assertTrue(weatherutils.status_is(result_2[0], "sun", self.__test_registry))
def when_tornado(self): """ Returns a sublist of the *Weather* list in the forecast, containing only items having tornado as weather condition. :returns: a list of *Weather* objects """ return weatherutils.filter_by_status(self._forecast.get_weathers(), "tornado", weather_code_registry)
def when_hurricane(self): """ Returns a sublist of the *Weather* list in the forecast, containing only items having hurricane as weather condition. :returns: a list of *Weather* objects """ return weatherutils.filter_by_status(self._forecast.get_weathers(), "hurricane", weather_code_registry)