Skip to content

Commit

Permalink
test: Unxfail 2 modin tests (#870)
Browse files Browse the repository at this point in the history
* fix: is_first_distinct for modin/cudf

* remove xfail
  • Loading branch information
MarcoGorelli authored Aug 26, 2024
1 parent 706b7c8 commit cad2284
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
8 changes: 6 additions & 2 deletions narwhals/_pandas_like/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,14 @@ def null_count(self: Self) -> int:
return self._native_series.isna().sum() # type: ignore[no-any-return]

def is_first_distinct(self: Self) -> Self:
return self._from_native_series(~self._native_series.duplicated(keep="first"))
res = ~self._native_series.duplicated(keep="first")
res = self._rename(res, self.name)
return self._from_native_series(res)

def is_last_distinct(self: Self) -> Self:
return self._from_native_series(~self._native_series.duplicated(keep="last"))
res = ~self._native_series.duplicated(keep="last")
res = self._rename(res, self.name)
return self._from_native_series(res)

def is_sorted(self: Self, *, descending: bool = False) -> bool:
if not isinstance(descending, bool):
Expand Down
7 changes: 1 addition & 6 deletions tests/expr_and_series/is_first_distinct_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Any

import pytest

import narwhals.stable.v1 as nw
from tests.utils import compare_dicts

Expand All @@ -11,10 +9,7 @@
}


def test_is_first_distinct_expr(constructor: Any, request: Any) -> None:
if "modin" in str(constructor):
# TODO(unassigned): why is Modin failing here?
request.applymarker(pytest.mark.xfail)
def test_is_first_distinct_expr(constructor: Any) -> None:
df = nw.from_native(constructor(data))
result = df.select(nw.all().is_first_distinct())
expected = {
Expand Down
7 changes: 1 addition & 6 deletions tests/expr_and_series/is_last_distinct_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Any

import pytest

import narwhals.stable.v1 as nw
from tests.utils import compare_dicts

Expand All @@ -11,10 +9,7 @@
}


def test_is_last_distinct_expr(constructor: Any, request: Any) -> None:
if "modin" in str(constructor):
# TODO(unassigned): why is Modin failing here?
request.applymarker(pytest.mark.xfail)
def test_is_last_distinct_expr(constructor: Any) -> None:
df = nw.from_native(constructor(data))
result = df.select(nw.all().is_last_distinct())
expected = {
Expand Down

0 comments on commit cad2284

Please sign in to comment.