Skip to content

Commit feff1f1

Browse files
authored
chore: use constructors (#1210)
1 parent 876303d commit feff1f1

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

tests/expr_and_series/str/contains_test.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import pandas as pd
4-
import polars as pl
53
import pytest
64

75
import narwhals.stable.v1 as nw
@@ -11,9 +9,6 @@
119

1210
data = {"pets": ["cat", "dog", "rabbit and parrot", "dove"]}
1311

14-
df_pandas = pd.DataFrame(data)
15-
df_polars = pl.DataFrame(data)
16-
1712

1813
def test_contains_case_insensitive(
1914
constructor: Constructor, request: pytest.FixtureRequest

tests/series_only/cast_test.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from datetime import date
44
from datetime import datetime
5+
from typing import TYPE_CHECKING
56

67
import pandas as pd
78
import polars as pl
@@ -12,16 +13,18 @@
1213
import narwhals.stable.v1 as nw
1314
from narwhals.utils import parse_version
1415

16+
if TYPE_CHECKING:
17+
from tests.utils import ConstructorEager
1518

16-
def test_cast_253() -> None:
17-
df_polars = pl.DataFrame({"a": [1]})
18-
result = nw.from_native(df_polars, eager_only=True).select(
19-
nw.col("a").cast(nw.String) + "hi"
20-
)["a"][0]
21-
assert result == "1hi"
2219

23-
df_pandas = pd.DataFrame({"a": [1]})
24-
result = nw.from_native(df_pandas, eager_only=True).select(
20+
def test_cast_253(
21+
request: pytest.FixtureRequest, constructor_eager: ConstructorEager
22+
) -> None:
23+
if "pyarrow_table" in str(constructor_eager):
24+
request.applymarker(pytest.mark.xfail)
25+
26+
df_raw = constructor_eager({"a": [1]})
27+
result = nw.from_native(df_raw, eager_only=True).select(
2528
nw.col("a").cast(nw.String) + "hi"
2629
)["a"][0]
2730
assert result == "1hi"

0 commit comments

Comments
 (0)