Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bschoenmaeckers committed Jan 22, 2025
1 parent e2d4e0f commit 2c139c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions py-polars/tests/unit/constructors/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def test_init_1d_sequence() -> None:
[datetime(2020, 1, 1, tzinfo=ZoneInfo("Asia/Kathmandu"))],
schema={"ts": pl.Datetime("ms")},
)
assert df.schema == {"ts": pl.Datetime("ms", "UTC")}
assert df.schema == {"ts": pl.Datetime("ms", "Asia/Kathmandu")}


def test_init_pandas(monkeypatch: Any) -> None:
Expand Down Expand Up @@ -1794,7 +1794,7 @@ def test_init_list_of_dicts_with_timezone(tz: Any) -> None:
expected = pl.DataFrame({"dt": [dt, dt]})
assert_frame_equal(df, expected)

assert df.schema == {"dt": pl.Datetime("us", time_zone=tz and "UTC")}
assert df.schema == {"dt": pl.Datetime("us", time_zone=tz)}


def test_init_from_subclassed_types() -> None:
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/datatypes/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ def test_tz_datetime_duration_arithm_5221() -> None:
def test_auto_infer_time_zone() -> None:
dt = datetime(2022, 10, 17, 10, tzinfo=ZoneInfo("Asia/Shanghai"))
s = pl.Series([dt])
assert s.dtype == pl.Datetime("us", "UTC")
assert s.dtype == pl.Datetime("us", "Asia/Shanghai")
assert s[0] == dt


Expand Down
10 changes: 7 additions & 3 deletions py-polars/tests/unit/functions/range/test_datetime_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ def test_datetime_range_lazy_time_zones() -> None:
)
expected = pl.DataFrame(
{
"start": [datetime(2019, 12, 31, 18, 15, tzinfo=ZoneInfo(key="UTC"))],
"stop": [datetime(2020, 1, 1, 18, 15, tzinfo=ZoneInfo(key="UTC"))],
"start": [
datetime(2020, 1, 1, 00, 00, tzinfo=ZoneInfo(key="Asia/Kathmandu"))
],
"stop": [
datetime(2020, 1, 2, 00, 00, tzinfo=ZoneInfo(key="Asia/Kathmandu"))
],
"literal": [
datetime(2020, 1, 1, 6, 15, tzinfo=ZoneInfo(key="Pacific/Tarawa"))
],
Expand Down Expand Up @@ -598,7 +602,7 @@ def test_datetime_range_fast_slow_paths(
unit: str,
start: datetime,
) -> None:
end = pl.select(pl.lit(start).dt.offset_by(f"{n*size}{unit}")).item()
end = pl.select(pl.lit(start).dt.offset_by(f"{n * size}{unit}")).item()
result_slow = pl.datetime_range(
start,
end,
Expand Down

0 comments on commit 2c139c9

Please sign in to comment.