Skip to content

Commit

Permalink
test: skip Ibis tests if deps aren't installed, set defaults in `Pand…
Browse files Browse the repository at this point in the history
…asLikeSeries.__array__` to fix cuDF is_in (#1862)

* chore: skip ibis tests if duckdb not installed

* __array__ defaults

* simpler fix
  • Loading branch information
MarcoGorelli authored Jan 25, 2025
1 parent aceec01 commit e9b2a1f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions narwhals/_pandas_like/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ def is_between(

def is_in(self: Self, other: Any) -> PandasLikeSeries:
ser = self._native_series
if isinstance(other, self.__class__):
# We can't use `broadcast_and_align` because we don't want to align here.
# `other` is just a sequence that all rows from `self` are checked against.
other = other._native_series
res = ser.isin(other)
return self._from_native_series(res)

Expand Down
6 changes: 5 additions & 1 deletion tests/frame/interchange_native_namespace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ def test_interchange() -> None:

@pytest.mark.filterwarnings("ignore:.*The `ArrowDtype` class is not available in pandas")
def test_ibis(
tmpdir: pytest.TempdirFactory,
tmpdir: pytest.TempdirFactory, request: pytest.FixtureRequest
) -> None: # pragma: no cover
ibis = pytest.importorskip("ibis")
try:
ibis.set_backend("duckdb")
except ImportError:
request.applymarker(pytest.mark.xfail)
df_pl = pl.DataFrame(data)

filepath = str(tmpdir / "file.parquet") # type: ignore[operator]
Expand Down
6 changes: 5 additions & 1 deletion tests/frame/interchange_schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ def test_interchange_schema() -> None:

@pytest.mark.filterwarnings("ignore:.*locale specific date formats")
def test_interchange_schema_ibis(
tmpdir: pytest.TempdirFactory,
tmpdir: pytest.TempdirFactory, request: pytest.FixtureRequest
) -> None: # pragma: no cover
ibis = pytest.importorskip("ibis")
try:
ibis.set_backend("duckdb")
except ImportError:
request.applymarker(pytest.mark.xfail)
df_pl = pl.DataFrame(
{
"a": [1, 1, 2],
Expand Down
6 changes: 5 additions & 1 deletion tests/frame/interchange_select_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ def test_interchange() -> None:


def test_interchange_ibis(
tmpdir: pytest.TempdirFactory,
tmpdir: pytest.TempdirFactory, request: pytest.FixtureRequest
) -> None: # pragma: no cover
ibis = pytest.importorskip("ibis")
try:
ibis.set_backend("duckdb")
except ImportError:
request.applymarker(pytest.mark.xfail)
df_pl = pl.DataFrame(data)

filepath = str(tmpdir / "file.parquet") # type: ignore[operator]
Expand Down
6 changes: 5 additions & 1 deletion tests/frame/interchange_to_arrow_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ def test_interchange_to_arrow() -> None:


def test_interchange_ibis_to_arrow(
tmpdir: pytest.TempdirFactory,
tmpdir: pytest.TempdirFactory, request: pytest.FixtureRequest
) -> None: # pragma: no cover
ibis = pytest.importorskip("ibis")
try:
ibis.set_backend("duckdb")
except ImportError:
request.applymarker(pytest.mark.xfail)
df_pl = pl.DataFrame(data)

filepath = str(tmpdir / "file.parquet") # type: ignore[operator]
Expand Down
4 changes: 4 additions & 0 deletions tests/frame/interchange_to_pandas_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def test_interchange_ibis_to_pandas(
request.applymarker(pytest.mark.xfail)

ibis = pytest.importorskip("ibis")
try:
ibis.set_backend("duckdb")
except ImportError:
request.applymarker(pytest.mark.xfail)
df_raw = pd.DataFrame(data)

filepath = str(tmpdir / "file.parquet") # type: ignore[operator]
Expand Down

0 comments on commit e9b2a1f

Please sign in to comment.