Skip to content

Commit 46b6317

Browse files
nmdefriesaysim319
authored andcommitted
list values added using actual day as an example
1 parent eb6a9be commit 46b6317

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

google_symptoms/tests/test_patch.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,24 @@ def parse_csv_file(self, file_list: List[str]) -> Tuple[List[datetime]]:
2525
return sorted(smoothed_list), sorted(raw_list)
2626

2727
def generate_expected_dates(self, params_, smoother, issue_date):
28-
max_expected_lag = lag_converter(params_["validation"]["common"].get("max_expected_lag", {"all": 4}))
29-
global_max_expected_lag = max(list(max_expected_lag.values()))
28+
dates_dict = {
29+
"2024-06-27": [ '2024-06-02', '2024-06-03', '2024-06-04', '2024-06-05', '2024-06-06', '2024-06-07', '2024-06-08', '2024-06-09', '2024-06-10', '2024-06-11', '2024-06-12', '2024-06-13', '2024-06-14', '2024-06-15', '2024-06-16', '2024-06-17', '2024-06-18', '2024-06-19', '2024-06-20', '2024-06-21', '2024-06-22'],
30+
"2024-06-28": ['2024-06-03', '2024-06-04', '2024-06-05', '2024-06-06', '2024-06-07', '2024-06-08', '2024-06-09', '2024-06-10', '2024-06-11', '2024-06-12', '2024-06-13', '2024-06-14', '2024-06-15', '2024-06-16', '2024-06-17', '2024-06-18', '2024-06-19', '2024-06-20', '2024-06-21', '2024-06-22', '2024-06-23'],
31+
"2024-06-29": ['2024-06-04', '2024-06-05', '2024-06-06','2024-06-07', '2024-06-08', '2024-06-09', '2024-06-10', '2024-06-11', '2024-06-12', '2024-06-13', '2024-06-14', '2024-06-15', '2024-06-16', '2024-06-17', '2024-06-18', '2024-06-19', '2024-06-20', '2024-06-21', '2024-06-22', '2024-06-23', '2024-06-24'],
32+
}
3033

31-
if params_["indicator"].get("num_export_days"):
32-
num_export_days = params_["indicator"]["num_export_days"]
34+
dates_dict = {
35+
datetime.strptime(key, "%Y-%m-%d"): [datetime.strptime(lvalue, "%Y-%m-%d") for lvalue in value]
36+
for key, value in dates_dict.items()
37+
}
38+
39+
40+
dates = dates_dict[issue_date]
41+
42+
if smoother == "raw":
43+
return dates
3344
else:
34-
num_export_days = params_["validation"]["common"].get("span_length", 14) + global_max_expected_lag
35-
36-
# mimic date generate as if the issue date was "today"
37-
query_start_date, query_end_date = generate_query_dates(
38-
FULL_BKFILL_START_DATE,
39-
issue_date,
40-
num_export_days,
41-
False
42-
)
43-
# the smoother in line 82-88 filters out prev seven days
44-
export_start_date = query_start_date + timedelta(days=6) if smoother == "smoothed" else query_start_date
45-
export_end_date = query_end_date - timedelta(days=global_max_expected_lag)
46-
num_export_days = (export_end_date - export_start_date).days + 1
47-
48-
return sorted([export_start_date + timedelta(days=x) for x in range(num_export_days)])
45+
return dates[6:21]
4946

5047
def mocked_patch(self, params_):
5148
with mock_patch("delphi_google_symptoms.patch.read_params", return_value=params_), \

0 commit comments

Comments
 (0)