def test_is_event_id(self): """Test to check if a event is in server """ assert is_event_id('20130110041009'), 'should be event id' assert not is_event_id('20130110041090'), 'should not be event id' assert not is_event_id('2013'), 'should not be event id' assert not is_event_id('AAA'), 'should not be event id'
def filter_zip_eq_event(zip_eq_event): """Return true if zip_eq_event in the following format: YYYYBBDDhhmmss.out.zip for example : 20130226211002.out.zip """ expected_len = len('20130226211002.out.zip') if len(zip_eq_event) != expected_len: return False my_event_id = zip_eq_event[:14] if is_event_id(my_event_id): return True else: return False
def filter_eq_map(eq_map_path): """Return true if eq_map_path in the following format: earthquake_impact_map_YYYYBBDDhhmmss.pdf for example : earthquake_impact_map_20120216181705.pdf :param eq_map_path """ expected_len = len('earthquake_impact_map_20120216181705.pdf') if len(eq_map_path) != expected_len: return False print 'eq', eq_map_path # if not re.match(eq_map_path, my_regex): # print 're' # return False my_event_id = get_event_id(eq_map_path) print 'my_event_id', my_event_id if is_event_id(my_event_id): return True else: print 'not event id' return False