|
1 | 1 | """Tests for dynamic validator."""
|
2 |
| -from datetime import date, datetime |
| 2 | +from datetime import date, datetime, timedelta |
3 | 3 | import numpy as np
|
4 | 4 | import pandas as pd
|
5 | 5 |
|
@@ -479,17 +479,14 @@ def test_date_comparison_by_type(self):
|
479 | 479 | validator = DynamicValidator(self.params)
|
480 | 480 | report = ValidationReport([])
|
481 | 481 |
|
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] |
487 | 483 | test_val = [100, 100, 100]
|
488 | 484 |
|
| 485 | + START = datetime.strptime("2020-10-01", "%Y-%m-%d") |
489 | 486 | ref_data = pd.DataFrame({"val": ref_val, "se": [np.nan] * len(ref_val),
|
490 | 487 | "sample_size": [np.nan] * len(ref_val), "geo_id": ["1"] * len(ref_val),
|
491 | 488 | # 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))}) |
493 | 490 | test_data = pd.DataFrame({"val": test_val, "se": [np.nan] * len(test_val),
|
494 | 491 | "sample_size": [np.nan] * len(test_val), "geo_id": ["1"] * len(test_val),
|
495 | 492 | # datetime.date type
|
|
0 commit comments