Skip to content

Commit e612d51

Browse files
committed
simplify test data and date construction
1 parent 1d5a78f commit e612d51

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

_delphi_utils_python/tests/validator/test_dynamic.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Tests for dynamic validator."""
2-
from datetime import date, datetime
2+
from datetime import date, datetime, timedelta
33
import numpy as np
44
import pandas as pd
55

@@ -479,17 +479,14 @@ def test_date_comparison_by_type(self):
479479
validator = DynamicValidator(self.params)
480480
report = ValidationReport([])
481481

482-
ref_val = [30, 30.28571429, 30.57142857, 30.85714286, 31.14285714,
483-
31.42857143, 31.71428571, 32, 32, 32.14285714,
484-
32.28571429, 32.42857143, 32.57142857, 32.71428571,
485-
32.85714286, 33, 33, 33, 33, 33, 33, 33, 33,
486-
33, 33, 33, 33.28571429, 33.57142857, 33.85714286, 34.14285714]
482+
ref_val = [30, 30, 30]
487483
test_val = [100, 100, 100]
488484

485+
START = datetime.strptime("2020-10-01", "%Y-%m-%d")
489486
ref_data = pd.DataFrame({"val": ref_val, "se": [np.nan] * len(ref_val),
490487
"sample_size": [np.nan] * len(ref_val), "geo_id": ["1"] * len(ref_val),
491488
# datetime64 type
492-
"time_value": pd.date_range(start="2020-09-24", end="2020-10-23")})
489+
"time_value": pd.date_range(start=START, end=START + timedelta(days=len(ref_val) - 1))})
493490
test_data = pd.DataFrame({"val": test_val, "se": [np.nan] * len(test_val),
494491
"sample_size": [np.nan] * len(test_val), "geo_id": ["1"] * len(test_val),
495492
# datetime.date type

0 commit comments

Comments
 (0)