Skip to content

Commit 52355ea

Browse files
authored
chore: prepare tests for v2 (#2380)
1 parent 2533342 commit 52355ea

File tree

193 files changed

+790
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+790
-647
lines changed

narwhals/_pandas_like/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ def to_numpy(self: Self, dtype: Any = None, *, copy: bool | None = None) -> _2DA
962962
def to_pandas(self: Self) -> pd.DataFrame:
963963
if self._implementation is Implementation.PANDAS:
964964
return self.native
965-
elif self._implementation is Implementation.CUDF: # pragma: no cover
965+
elif self._implementation is Implementation.CUDF:
966966
return self.native.to_pandas()
967967
elif self._implementation is Implementation.MODIN:
968968
return self.native._to_pandas()

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,15 @@ omit = [
255255
exclude_also = [
256256
"if sys.version_info() <",
257257
"if .*implementation is Implementation.CUDF",
258+
"if .*implementation is Implementation.MODIN",
258259
"if .*implementation is Implementation.PYSPARK",
259260
"if .*implementation.is_cudf",
261+
"if .*implementation.is_modin",
260262
"if .*implementation.is_pyspark",
261263
'request.applymarker\(pytest.mark.xfail',
262264
'backend_version <',
263265
'if "cudf" in str\(constructor',
266+
'if "modin" in str\(constructor',
264267
'if "pyspark" in str\(constructor',
265268
'pytest.skip\('
266269
]

tests/dependencies/is_narwhals_dataframe_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import TYPE_CHECKING
44

55
import narwhals as nw
6-
import narwhals.stable.v1 as nws
6+
import narwhals.stable.v1 as nw_v1
77
from narwhals.stable.v1.dependencies import is_narwhals_dataframe
88

99
if TYPE_CHECKING:
@@ -14,5 +14,5 @@ def test_is_narwhals_dataframe(constructor_eager: ConstructorEager) -> None:
1414
df = constructor_eager({"col1": [1, 2], "col2": [3, 4]})
1515

1616
assert is_narwhals_dataframe(nw.from_native(df))
17-
assert is_narwhals_dataframe(nws.from_native(df))
17+
assert is_narwhals_dataframe(nw_v1.from_native(df))
1818
assert not is_narwhals_dataframe(df)

tests/dependencies/is_narwhals_lazyframe_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import TYPE_CHECKING
44

55
import narwhals as nw
6-
import narwhals.stable.v1 as nws
6+
import narwhals.stable.v1 as nw_v1
77
from narwhals.stable.v1.dependencies import is_narwhals_lazyframe
88
from tests.utils import Constructor
99

@@ -15,5 +15,5 @@ def test_is_narwhals_lazyframe(constructor: Constructor) -> None:
1515
lf = constructor({"a": [1, 2, 3]})
1616

1717
assert is_narwhals_lazyframe(nw.from_native(lf).lazy())
18-
assert is_narwhals_lazyframe(nws.from_native(lf).lazy())
18+
assert is_narwhals_lazyframe(nw_v1.from_native(lf).lazy())
1919
assert not is_narwhals_lazyframe(lf)

tests/dependencies/is_narwhals_series_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import TYPE_CHECKING
44

55
import narwhals as nw
6-
import narwhals.stable.v1 as nws
6+
import narwhals.stable.v1 as nw_v1
77
from narwhals.stable.v1.dependencies import is_narwhals_series
88

99
if TYPE_CHECKING:
@@ -14,5 +14,5 @@ def test_is_narwhals_series(constructor_eager: ConstructorEager) -> None:
1414
df = constructor_eager({"col1": [1, 2], "col2": [3, 4]})
1515

1616
assert is_narwhals_series(nw.from_native(df, eager_only=True)["col1"])
17-
assert is_narwhals_series(nws.from_native(df, eager_only=True)["col1"])
17+
assert is_narwhals_series(nw_v1.from_native(df, eager_only=True)["col1"])
1818
assert not is_narwhals_series(nw.from_native(df, eager_only=True)["col1"].to_native())

tests/dtypes_test.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pyarrow as pa
1212
import pytest
1313

14-
import narwhals.stable.v1 as nw
14+
import narwhals as nw
1515
from tests.utils import PANDAS_VERSION
1616
from tests.utils import POLARS_VERSION
1717
from tests.utils import PYARROW_VERSION
@@ -308,7 +308,13 @@ def test_dtype_is_x() -> None:
308308
)
309309

310310
is_signed_integer = {nw.Int8, nw.Int16, nw.Int32, nw.Int64, nw.Int128}
311-
is_unsigned_integer = {nw.UInt8, nw.UInt16, nw.UInt32, nw.UInt64, nw.UInt128}
311+
is_unsigned_integer = {
312+
nw.UInt8,
313+
nw.UInt16,
314+
nw.UInt32,
315+
nw.UInt64,
316+
nw.UInt128,
317+
}
312318
is_float = {nw.Float32, nw.Float64}
313319
is_decimal = {nw.Decimal}
314320
is_temporal = {nw.Datetime, nw.Date, nw.Duration, nw.Time}
@@ -353,7 +359,8 @@ def test_huge_int_to_native() -> None:
353359
result = (
354360
nw.from_native(rel)
355361
.with_columns(
356-
a_int=nw.col("a").cast(nw.Int128()), a_unit=nw.col("a").cast(nw.UInt128())
362+
a_int=nw.col("a").cast(nw.Int128()),
363+
a_unit=nw.col("a").cast(nw.UInt128()),
357364
)
358365
.select("a_int", "a_unit")
359366
.to_native()

tests/expr_and_series/abs_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
import narwhals.stable.v1 as nw
3+
import narwhals as nw
44
from tests.utils import Constructor
55
from tests.utils import ConstructorEager
66
from tests.utils import assert_equal_data

tests/expr_and_series/all_horizontal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
import narwhals.stable.v1 as nw
7+
import narwhals as nw
88
from tests.utils import POLARS_VERSION
99
from tests.utils import Constructor
1010
from tests.utils import ConstructorEager

tests/expr_and_series/any_all_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
import narwhals.stable.v1 as nw
3+
import narwhals as nw
44
from tests.utils import Constructor
55
from tests.utils import ConstructorEager
66
from tests.utils import assert_equal_data

tests/expr_and_series/any_horizontal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
import narwhals.stable.v1 as nw
7+
import narwhals as nw
88
from tests.utils import Constructor
99
from tests.utils import assert_equal_data
1010

0 commit comments

Comments
 (0)