def test_time_subset_match(self, get_files): inputs = {"time": "1859-12/2005-11"} # start defaults to 1st of month # end defaults to 30th of month # the start and end day of dataset is 16th so this results in a requested time range outside of the actual range # so this is aligned. sac = SubsetAlignmentChecker(get_files, inputs) assert sac.is_aligned is True assert sac.aligned_files == get_files
def test_time_subset_matches_including_hour(self, get_files): """Tests alignment of full dataset where: - Real range: 1859-12-16T00:00:00 to 2005-11-16T00:00:00 - Start: 1859-12-16T00:00:00 (exact start) - End: 2005-11-16T00:00:00 (exact end) """ inputs = {"time": "1859-12-16T00:00:00/2005-11-16T00:00:00"} sac = SubsetAlignmentChecker(get_files, inputs) assert sac.is_aligned is True assert sac.aligned_files == get_files
def test_time_subset_no_match_including_hour(self, get_files): """Tests not aligned when time not aligned with file: - Real range: 1850-01-01T12:00:00 to 2009-11-30T12:00:00 - Start: 1850-01-01T14:00:00 (start) - End: 2009-11-30T12:00:00 (exact end) """ inputs = {"time": "1850-01-01T14:00:00/2009-11-30T12:00:00"} sac = SubsetAlignmentChecker(get_files, inputs) assert sac.is_aligned is False assert sac.aligned_files == []
def test_time_subset_matches_before_to_after(self, get_files): """Tests alignment of full dataset where: - Real range: 18500101-20091130 - Start: 17000101 (before) - End: 29991230 (after) """ inputs = {"time": "1700-01-01/2999-12-30"} sac = SubsetAlignmentChecker(get_files, inputs) assert sac.is_aligned is True assert sac.aligned_files == get_files
def test_time_subset_matches_exact_range_excluding_hour(self, get_files): """Tests alignment of full dataset where: - Real range: 18500101-20091130 - Start: 18500101 (exact start) - End: 20091130 (exact end) """ inputs = {"time": "1850-01-01/2009-11-30"} sac = SubsetAlignmentChecker(get_files, inputs) assert sac.is_aligned is True assert sac.aligned_files == get_files
def test_time_subset_matches_no_hour(self, get_files): """Tests alignment of full dataset where: - Real range: 1859-12-16T00:00:00 to 2005-11-16T00:00:00 - Start: 1859-12-16 (start without hour) - End: 2005-11-16 (end without hour) """ inputs = {"time": "1859-12-16/2005-11-16"} sac = SubsetAlignmentChecker(get_files, inputs) # aligns because default is timestamp of 00:00:00 if not provided assert sac.is_aligned is True assert sac.aligned_files == get_files
def test_no_subset(self, get_files): inputs = {} sac = SubsetAlignmentChecker(get_files, inputs) assert sac.is_aligned is True assert sac.aligned_files == get_files