def test_regex_data(): prefix = r'https://gong2.nso.edu/oQR/zqs/' pattern = prefix + r'%Y%m/mrzqs%y%m%d/mrzqs%y%m%dt%H%Mc(\d){4}_(\d){3}\.fits.gz' s = Scraper(pattern, regex=True) timerange = TimeRange('2020-01-05', '2020-01-06T16:00:00') assert s._URL_followsPattern(prefix + '202001/mrzqs200106/mrzqs200106t1514c2226_297.fits.gz') assert len(s.filelist(timerange)) == 37
def testURL_patternMillisecondsGeneric(): s = Scraper('fd_%Y%m%d_%H%M%S_%e.fts') assert s._URL_followsPattern('fd_20130410_231211_119.fts') assert not s._URL_followsPattern('fd_20130410_231211.fts.gz') assert not s._URL_followsPattern('fd_20130410_ar_231211.fts.gz')
def test_regex(pattern, check_file): s = Scraper(pattern, regex=True) assert s._URL_followsPattern(check_file)
def testURL_pattern(): s = Scraper('fd_%Y%m%d_%H%M%S.fts') assert s._URL_followsPattern('fd_20130410_231211.fts') assert not s._URL_followsPattern('fd_20130410_231211.fts.gz') assert not s._URL_followsPattern('fd_20130410_ar_231211.fts.gz')