Skip to content

Commit

Permalink
Time change test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgboss committed Nov 7, 2023
1 parent 353dac6 commit 9df5088
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/app/tests/utils/test_time.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime
from app.utils.time import get_utc_datetime, get_days_from_range
import pytz


def test_get_utc_datetime():
Expand Down Expand Up @@ -42,3 +43,11 @@ def test_time_range_end_before_start():
oct_10_2022 = datetime(year=2022, month=10, day=10, hour=8, minute=30, second=30)
days = get_days_from_range(oct_10_2022, oct_1_2022)
assert (len(days) == 0)

def test_time_range_across_time_change():
"Time change should not impact range."
vancouver_tz = pytz.timezone("America/Vancouver")
nov_1_2023 = vancouver_tz.localize(datetime(year=2023, month=11, day=1, hour=0, minute=0, second=0))
nov_6_2023 = vancouver_tz.localize(datetime(year=2023, month=11, day=6, hour=23, minute=59, second=59))
days = get_days_from_range(nov_1_2023, nov_6_2023)
assert (len(days) == 6)

0 comments on commit 9df5088

Please sign in to comment.