Skip to content

Commit

Permalink
info_date_shift should be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MDobransky committed Aug 29, 2024
1 parent 714ad58 commit 3f2ce2f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rialto/runner/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IntervalConfig(BaseModel):
class ScheduleConfig(BaseModel):
frequency: str
day: Optional[int] = 0
info_date_shift: List[IntervalConfig] = IntervalConfig(units="days", value=0)
info_date_shift: Optional[List[IntervalConfig]] = IntervalConfig(units="days", value=0)


class DependencyConfig(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions tests/runner/test_date_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_run_dates_invalid():
[(7, "2023-02-26"), (3, "2023-03-02"), (-5, "2023-03-10"), (0, "2023-03-05")],
)
def test_to_info_date(shift, res):
cfg = ScheduleConfig(frequency="daily", info_date_shift=IntervalConfig(units="days", value=shift))
cfg = ScheduleConfig(frequency="daily", info_date_shift=[IntervalConfig(units="days", value=shift)])
base = DateManager.str_to_date("2023-03-05")
info = DateManager.to_info_date(base, cfg)
assert DateManager.str_to_date(res) == info
Expand All @@ -155,7 +155,7 @@ def test_to_info_date(shift, res):
[("days", "2023-03-02"), ("weeks", "2023-02-12"), ("months", "2022-12-05"), ("years", "2020-03-05")],
)
def test_info_date_shift_units(unit, result):
cfg = ScheduleConfig(frequency="daily", info_date_shift=IntervalConfig(units=unit, value=3))
cfg = ScheduleConfig(frequency="daily", info_date_shift=[IntervalConfig(units=unit, value=3)])
base = DateManager.str_to_date("2023-03-05")
info = DateManager.to_info_date(base, cfg)
assert DateManager.str_to_date(result) == info
Expand Down
4 changes: 2 additions & 2 deletions tests/runner/transformations/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ pipelines:
frequency: weekly
day: 7
info_date_shift:
value: 3
units: days
- value: 3
units: days
- name: NamedDeps
module:
python_module: tests.runner.transformations
Expand Down

0 comments on commit 3f2ce2f

Please sign in to comment.