Skip to content

Commit

Permalink
apply black
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Garcia Reolid <[email protected]>
  • Loading branch information
victorgarcia98 committed Mar 21, 2024
1 parent 3e62ef2 commit e9d320b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion timely_beliefs/sensors/func_store/knowledge_horizons.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def x_years_ago_at_date(
raise ValueError("Negative value for `x` not supported.")

if get_bounds:
return timedelta(days=(x-1)*366 - 3), timedelta(days=(x+1)*366 +1)
return timedelta(days=(x - 1) * 366 - 3), timedelta(days=(x + 1) * 366 + 1)

if isinstance(event_start, datetime):
return x_years_ago_at_date_datetime(event_start, day, month, x, z)
Expand Down
17 changes: 10 additions & 7 deletions timely_beliefs/sensors/func_store/test_knowledge_horizons.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,20 @@ def test_x_years_ago_at_date():
) # 365 days + 366 days - 1 day



@pytest.mark.parametrize("event_start", [
datetime(2024, 1, 1, 0, tzinfo=utc),
datetime(2024, 12, 31, 23, 59, 59, tzinfo=utc)
])
@pytest.mark.parametrize(
"event_start",
[
datetime(2024, 1, 1, 0, tzinfo=utc),
datetime(2024, 12, 31, 23, 59, 59, tzinfo=utc),
],
)
@pytest.mark.parametrize("year", list(range(6)))
def test_x_years_ago_at_date_bounds(event_start, year):
knowledge_func_params = dict(month=12, day=31, x=year)

timedelta_bounds = x_years_ago_at_date(event_start, get_bounds=True, **knowledge_func_params)
timedelta_bounds = x_years_ago_at_date(
event_start, get_bounds=True, **knowledge_func_params
)

assert (
timedelta_bounds[0]
Expand All @@ -163,7 +167,6 @@ def test_x_years_ago_at_date_bounds(event_start, year):
)



def test_dst():
"""Check definition of knowledge horizon for events known x days ago at y o'clock in some timezone z,
especially around daylight savings time (DST) transitions."""
Expand Down

0 comments on commit e9d320b

Please sign in to comment.