Skip to content

Commit

Permalink
Use local_tz
Browse files Browse the repository at this point in the history
  • Loading branch information
atuonufure committed Jan 17, 2024
1 parent 2c03c00 commit 50cf522
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_evaluators.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ def misc_functions_test(resource, path, expected):
def time_functions_test():
local_tz = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo

tz_offset = datetime.timezone(datetime.timedelta(hours=2))
# tz_offset = datetime.timezone(datetime.timedelta(hours=2))
with freeze_time(
lambda: datetime.datetime(year=2020, month=8, day=20, hour=17, minute=52, second=15)
):
assert (
datetime.datetime.fromisoformat(evaluate({}, "now()")[0].getDateTimeMatchStr()).timestamp()
== datetime.datetime.now().replace(tzinfo=tz_offset).timestamp()
== datetime.datetime.now().replace(tzinfo=local_tz).timestamp()
)
assert evaluate({}, "today()") == ["2020-08-20"]
assert [evaluate({}, "timeOfDay()")[0].getTimeMatchStr()] == ["17:52:15"]
Expand Down

0 comments on commit 50cf522

Please sign in to comment.