diff --git a/tests/series/test_cast.py b/tests/series/test_cast.py index e07769d4ce..9367ba131c 100644 --- a/tests/series/test_cast.py +++ b/tests/series/test_cast.py @@ -763,10 +763,13 @@ def test_series_cast_struct_add_col() -> None: def test_cast_date_to_timestamp(): - from datetime import date + from datetime import date, datetime + + import pytz input = Series.from_pylist([date(2022, 1, 6)]) casted = input.cast(DataType.timestamp("us", "UTC")) - # DO ASSERT AS TIMESTAMP + assert casted.to_pylist() == [datetime(2022, 1, 6, tzinfo=pytz.utc)] + back = casted.dt.date() assert (input == back).to_pylist() == [True] diff --git a/tests/series/test_comparisons.py b/tests/series/test_comparisons.py index 811670de40..bcb64d3723 100644 --- a/tests/series/test_comparisons.py +++ b/tests/series/test_comparisons.py @@ -724,6 +724,12 @@ def test_compare_lt_timestamps_tz_date(): assert (tz1 < tz2).to_pylist() == [True] +def test_compare_lt_timestamps_tz_date_same(): + tz1 = Series.from_pylist([datetime(2022, 1, 6, tzinfo=pytz.utc)]) + tz2 = Series.from_pylist([date(2022, 1, 6)]) + assert (tz1 < tz2).to_pylist() == [False] + + @pytest.mark.parametrize("tu1, tu2", itertools.product(["ns", "us", "ms"], repeat=2)) def test_compare_timestamps_same_tz(tu1, tu2): tz1 = Series.from_pylist([datetime(2022, 1, 1, tzinfo=pytz.utc)]).cast(DataType.timestamp(tu1, "UTC"))