Skip to content

Commit cad2284

Browse files
authored
test: Unxfail 2 modin tests (#870)
* fix: is_first_distinct for modin/cudf * remove xfail
1 parent 706b7c8 commit cad2284

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

narwhals/_pandas_like/series.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,14 @@ def null_count(self: Self) -> int:
527527
return self._native_series.isna().sum() # type: ignore[no-any-return]
528528

529529
def is_first_distinct(self: Self) -> Self:
530-
return self._from_native_series(~self._native_series.duplicated(keep="first"))
530+
res = ~self._native_series.duplicated(keep="first")
531+
res = self._rename(res, self.name)
532+
return self._from_native_series(res)
531533

532534
def is_last_distinct(self: Self) -> Self:
533-
return self._from_native_series(~self._native_series.duplicated(keep="last"))
535+
res = ~self._native_series.duplicated(keep="last")
536+
res = self._rename(res, self.name)
537+
return self._from_native_series(res)
534538

535539
def is_sorted(self: Self, *, descending: bool = False) -> bool:
536540
if not isinstance(descending, bool):

tests/expr_and_series/is_first_distinct_test.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from typing import Any
22

3-
import pytest
4-
53
import narwhals.stable.v1 as nw
64
from tests.utils import compare_dicts
75

@@ -11,10 +9,7 @@
119
}
1210

1311

14-
def test_is_first_distinct_expr(constructor: Any, request: Any) -> None:
15-
if "modin" in str(constructor):
16-
# TODO(unassigned): why is Modin failing here?
17-
request.applymarker(pytest.mark.xfail)
12+
def test_is_first_distinct_expr(constructor: Any) -> None:
1813
df = nw.from_native(constructor(data))
1914
result = df.select(nw.all().is_first_distinct())
2015
expected = {

tests/expr_and_series/is_last_distinct_test.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from typing import Any
22

3-
import pytest
4-
53
import narwhals.stable.v1 as nw
64
from tests.utils import compare_dicts
75

@@ -11,10 +9,7 @@
119
}
1210

1311

14-
def test_is_last_distinct_expr(constructor: Any, request: Any) -> None:
15-
if "modin" in str(constructor):
16-
# TODO(unassigned): why is Modin failing here?
17-
request.applymarker(pytest.mark.xfail)
12+
def test_is_last_distinct_expr(constructor: Any) -> None:
1813
df = nw.from_native(constructor(data))
1914
result = df.select(nw.all().is_last_distinct())
2015
expected = {

0 commit comments

Comments
 (0)