Skip to content

Commit

Permalink
add test for parse_str_timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt committed May 30, 2024
1 parent 7e5509a commit a5498ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/tests_unit/test_utils/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
granularity_to_ms,
ms_to_datetime,
pandas_date_range_tz,
parse_str_timezone,
parse_str_timezone_offset,
split_time_range,
timestamp_to_ms,
Expand Down Expand Up @@ -61,6 +62,20 @@ def test_parse_str_timezone_offset(offset_inp, expected):
assert res == timezone(int(pm + "1") * expected)


@pytest.mark.parametrize(
"inp, expected",
(
("Europe/Oslo", ZoneInfo("Europe/Oslo")),
("Asia/Tokyo", ZoneInfo("Asia/Tokyo")),
("GMT", ZoneInfo("GMT")),
("UTC-0", timezone.utc),
("UTC+01:15", timezone(timedelta(seconds=4500))),
),
)
def test_parse_str_timezone_asd(inp, expected):
assert expected == parse_str_timezone(inp)


class TestDatetimeToMsIsoTimestamp:
@pytest.mark.skipif(platform.system() == "Windows", reason="Overriding timezone is too much hassle on Windows")
def test_timezone_unaware(self):
Expand Down

0 comments on commit a5498ff

Please sign in to comment.