Skip to content

Commit

Permalink
TST: Interchange implementation for timestamp[ns][pyarrow] (#57026)
Browse files Browse the repository at this point in the history
* TST: Interchange implementation for timestamp[ns][pyarrow]

* Check timestamp explicitly

* Use pytest.importorskip

---------

Co-authored-by: Marco Edward Gorelli <[email protected]>
  • Loading branch information
aidoskanapyanov and MarcoGorelli authored Jan 29, 2024
1 parent 46163c5 commit 56b5979
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pandas/tests/interchange/test_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,30 @@ def test_multi_chunk_pyarrow() -> None:
pd.api.interchange.from_dataframe(table, allow_copy=False)


def test_timestamp_ns_pyarrow():
# GH 56712
pytest.importorskip("pyarrow", "11.0.0")
timestamp_args = {
"year": 2000,
"month": 1,
"day": 1,
"hour": 1,
"minute": 1,
"second": 1,
}
df = pd.Series(
[datetime(**timestamp_args)],
dtype="timestamp[ns][pyarrow]",
name="col0",
).to_frame()

dfi = df.__dataframe__()
result = pd.api.interchange.from_dataframe(dfi)["col0"].item()

expected = pd.Timestamp(**timestamp_args)
assert result == expected


@pytest.mark.parametrize("tz", ["UTC", "US/Pacific"])
def test_datetimetzdtype(tz, unit):
# GH 54239
Expand Down

0 comments on commit 56b5979

Please sign in to comment.