Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions narwhals/_spark_like/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def _fill_constant(expr: Column, value: Column) -> Column:
assert value is not None # noqa: S101
return self._with_elementwise(_fill_constant, value=value)

def replace_strict( # pragma: no cover
def replace_strict(
self,
default: SparkLikeExpr | NoDefault,
old: Sequence[Any],
Expand All @@ -372,8 +372,7 @@ def replace_strict( # pragma: no cover
msg = "`replace_strict` requires an explicit value for `default` for any spark-like backend."
raise ValueError(msg)

if self._implementation is not Implementation.PYSPARK:
# Issue tracker: https://github.com/eakmanrq/sqlframe/issues/545
if self._implementation is Implementation.PYSPARK_CONNECT:
msg = f"`replace_strict` is not (yet) implemented for {self._implementation}."
raise NotImplementedError(msg)

Expand Down
19 changes: 0 additions & 19 deletions tests/expr_and_series/replace_strict_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
polars_lt_v1 = POLARS_VERSION < (1, 0, 0)
skip_reason = "replace_strict only available after 1.0"
pl_skip_reason = "replace_strict only available after 1.0"
sqlframe_xfail_reason = (
"AttributeError: module 'sqlframe.duckdb.functions' has no attribute 'map_keys'.\n"
"Issue tracker: https://github.com/eakmanrq/sqlframe/issues/545"
)


def xfail_if_no_default(constructor: Constructor, request: pytest.FixtureRequest) -> None:
Expand Down Expand Up @@ -144,9 +140,6 @@ def test_replace_strict_expr_with_default(
if "polars" in str(constructor) and polars_lt_v1:
pytest.skip(reason=pl_skip_reason)

if "sqlframe" in str(constructor):
request.applymarker(pytest.mark.xfail(reason=sqlframe_xfail_reason))

df = nw.from_native(constructor({"a": [1, 2, 3, 4]}))
result = df.select(
nw.col("a").replace_strict(
Expand Down Expand Up @@ -180,9 +173,6 @@ def test_replace_strict_with_default_and_nulls(
if "polars" in str(constructor) and polars_lt_v1:
pytest.skip(reason=pl_skip_reason)

if "sqlframe" in str(constructor):
request.applymarker(pytest.mark.xfail(reason=sqlframe_xfail_reason))

df = nw.from_native(constructor({"a": [1, 2, None, 4]}))
result = df.select(
nw.col("a").replace_strict([1, 2], [10, 20], default=99, return_dtype=nw.Int64)
Expand All @@ -198,9 +188,6 @@ def test_replace_strict_with_default_mapping(
if "polars" in str(constructor) and polars_lt_v1:
pytest.skip(reason=pl_skip_reason)

if "sqlframe" in str(constructor):
request.applymarker(pytest.mark.xfail(reason=sqlframe_xfail_reason))

df = nw.from_native(constructor({"a": [1, 2, 3, 4]}))
result = df.select(
nw.col("a").replace_strict(
Expand All @@ -218,9 +205,6 @@ def test_replace_strict_with_expressified_default(
if "polars" in str(constructor) and polars_lt_v1:
pytest.skip(reason=pl_skip_reason)

if "sqlframe" in str(constructor):
request.applymarker(pytest.mark.xfail(reason=sqlframe_xfail_reason))

data = {"a": [1, 2, 3, 4], "b": ["beluga", "narwhal", "orca", "vaquita"]}
df = nw.from_native(constructor(data))
result = df.select(
Expand Down Expand Up @@ -254,9 +238,6 @@ def test_mapping_key_not_in_expr(
if "polars" in str(constructor) and polars_lt_v1:
pytest.skip(reason=pl_skip_reason)

if "sqlframe" in str(constructor):
request.applymarker(pytest.mark.xfail(reason=sqlframe_xfail_reason))

data = {"a": [1, 2]}
df = nw.from_native(constructor(data))

Expand Down
Loading