Skip to content

Commit 8028959

Browse files
zhuoran-Cheng16krivard
authored andcommitted
add the test (failed approach, cannot get exception)
1 parent c8c3295 commit 8028959

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/acquisition/covidcast/test_csv_importer.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ def test_is_sane_week(self):
4141
self.assertFalse(CsvImporter.is_sane_week(202000))
4242
self.assertFalse(CsvImporter.is_sane_week(202054))
4343
self.assertFalse(CsvImporter.is_sane_week(20200418))
44+
45+
def test_find_issue_specific_csv_files(self):
46+
"""Recursively explore and find issue specific CSV files."""
47+
48+
path_prefix='prefix/to/the/data/'
49+
#valid day path
50+
glob_paths = [path_prefix +'/archive/failed/src-name/issue_20200408']
51+
issue_path='/archive/failed/src-name/issue_20200408'
52+
mock_glob = MagicMock()
53+
mock_glob.glob.return_value = glob_paths
54+
issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(issue_path.lower())
55+
issue_date_value = int(issuedir_match.group(2))
56+
57+
#check if the day is a valid issue day.
58+
self.assertTrue(CsvImporter.is_sane_day(issue_date_value))
59+
60+
with self.assertRaises(Exception):
61+
CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob)
62+
63+
64+
4465

4566
def test_find_csv_files(self):
4667
"""Recursively explore and find CSV files."""

0 commit comments

Comments
 (0)