Skip to content

Commit

Permalink
test extra test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Oct 6, 2024
1 parent 349ee2b commit 459795b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/dtypes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import numpy as np
import pandas as pd
import polars as pl
import pyarrow as pa
import pytest

Expand Down Expand Up @@ -86,6 +87,22 @@ def test_array_valid() -> None:
dtype = nw.Array(nw.Int64)


@pytest.mark.skipif(
parse_version(pl.__version__) < (1,), reason="`shape` is only available after 1.0"
)
def test_polars_2d_array() -> None:
df = pl.DataFrame(
{"a": [[[1, 2], [3, 4], [5, 6]]]}, schema={"a": pl.Array(pl.Int64, (3, 2))}
)
assert nw.from_native(df).collect_schema()["a"] == nw.Array(nw.Array(nw.Int64, 2), 3)
assert nw.from_native(df.to_arrow()).collect_schema()["a"] == nw.Array(
nw.Array(nw.Int64, 2), 3
)
assert nw.from_native(
df.to_pandas(use_pyarrow_extension_array=True)
).collect_schema()["a"] == nw.Array(nw.Array(nw.Int64, 2), 3)


def test_second_time_unit() -> None:
s = pd.Series(np.array([np.datetime64("2020-01-01", "s")]))
result = nw.from_native(s, series_only=True)
Expand Down

0 comments on commit 459795b

Please sign in to comment.