def test_check_target_vars_both_events(self): """Ensures correct output from _check_target_vars. In this case, target variables have different event types (wind and tornado). """ these_target_names = [ NEAR_TORNADO_TARGET_NAME, MEDIUM_TORNADO_TARGET_NAME, FAR_TORNADO_TARGET_NAME, WIND_TARGET_NAME ] with self.assertRaises(ValueError): input_examples._check_target_vars(these_target_names)
def test_check_target_vars_bad_tornado(self): """Ensures correct output from _check_target_vars. In this case, event type is tornado target variables do *not* have the same mean lead time. """ these_target_names = [ NEAR_TORNADO_TARGET_NAME, MEDIUM_TORNADO_TARGET_NAME, FAR_TORNADO_TARGET_NAME, BAD_TORNADO_TARGET_NAME ] with self.assertRaises(ValueError): input_examples._check_target_vars(these_target_names)
def test_check_target_vars_good_wind(self): """Ensures correct output from _check_target_vars. In this case, event type is wind and all target variables have the same mean lead time. """ this_mean_lead_time_sec, this_event_type_string = ( input_examples._check_target_vars([WIND_TARGET_NAME])) self.assertTrue(this_mean_lead_time_sec == WIND_MEAN_LEAD_TIME_SEC) self.assertTrue(this_event_type_string == linkage.WIND_EVENT_STRING)
def test_check_target_vars_good_tornado(self): """Ensures correct output from _check_target_vars. In this case, event type is tornado and all target variables have the same mean lead time. """ these_target_names = [ NEAR_TORNADO_TARGET_NAME, MEDIUM_TORNADO_TARGET_NAME, FAR_TORNADO_TARGET_NAME ] this_mean_lead_time_sec, this_event_type_string = ( input_examples._check_target_vars(these_target_names)) self.assertTrue(this_mean_lead_time_sec == TORNADO_MEAN_LEAD_TIME_SEC) self.assertTrue(this_event_type_string == linkage.TORNADO_EVENT_STRING)