Skip to content

Commit

Permalink
test(mediacloud): fix tests about time slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpomerenke committed Aug 4, 2024
1 parent cfd979b commit 3982555
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _story_list_all_pages(
def _slice_date_range(start: date, end: date) -> list[tuple[date, date]]:
result = []
current = start.replace(day=1)
while current <= end:
while current <= min(end, date.today()):
next_month = current + relativedelta(months=1)
last_day = min(next_month - timedelta(days=1), date.today())
result.append((current, last_day))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_slicing_future_end_date():
def test_slicing_same_month():
start = date(2023, 3, 10)
end = date(2023, 3, 20)
expected = [(date(2023, 3, 1), date(2023, 3, 20))]
expected = [(date(2023, 3, 1), date(2023, 3, 31))]
assert _slice_date_range(start, end) == expected


Expand Down

0 comments on commit 3982555

Please sign in to comment.