diff --git a/tests/frame/rows_test.py b/tests/frame/rows_test.py index 0e6805da2..ccd3cdfbf 100644 --- a/tests/frame/rows_test.py +++ b/tests/frame/rows_test.py @@ -62,7 +62,7 @@ def test_iter_rows( named: bool, # noqa: FBT001 expected: list[tuple[Any, ...]] | list[dict[str, Any]], ) -> None: - df = nw.DataFrame(df_raw) + df = nw.from_native(df_raw, eager_only=True) result = list(df.iter_rows(named=named)) assert result == expected @@ -89,7 +89,7 @@ def test_rows( named: bool, # noqa: FBT001 expected: list[tuple[Any, ...]] | list[dict[str, Any]], ) -> None: - df = nw.DataFrame(df_raw) + df = nw.from_native(df_raw, eager_only=True) if isinstance(df_raw, pa.Table) and not named: with pytest.raises( NotImplementedError, @@ -104,7 +104,7 @@ def test_rows( @pytest.mark.parametrize("df_raw", [df_pandas_na, df_polars_na]) def test_rows_with_nulls_unnamed(df_raw: Any) -> None: # GIVEN - df = nw.DataFrame(df_raw) + df = nw.from_native(df_raw, eager_only=True) # WHEN result = list(df.iter_rows(named=False)) @@ -123,7 +123,7 @@ def test_rows_with_nulls_unnamed(df_raw: Any) -> None: @pytest.mark.parametrize("df_raw", [df_pandas_na, df_polars_na]) def test_rows_with_nulls_named(df_raw: Any) -> None: # GIVEN - df = nw.DataFrame(df_raw) + df = nw.from_native(df_raw, eager_only=True) # WHEN result = list(df.iter_rows(named=True)) diff --git a/tests/frame/schema_test.py b/tests/frame/schema_test.py index 67e634aee..8abbb3496 100644 --- a/tests/frame/schema_test.py +++ b/tests/frame/schema_test.py @@ -89,7 +89,7 @@ def test_dtypes() -> None: "r": pl.Enum(["a", "b"]), }, ) - df = nw.DataFrame(df_pl) + df = nw.from_native(df_pl, eager_only=True) result = df.schema expected = { "a": nw.Int64, @@ -117,12 +117,12 @@ def test_dtypes() -> None: # pandas/pyarrow only have categorical, not enum expected["r"] = nw.Categorical df_pd = df_pl.to_pandas(use_pyarrow_extension_array=True) - df = nw.DataFrame(df_pd) + df = nw.from_native(df_pd, eager_only=True) result_pd = df.schema assert result_pd == expected assert {name: df[name].dtype for name in df.columns} == expected df_pa = df_pl.to_arrow() - df = nw.DataFrame(df_pa) + df = nw.from_native(df_pa, eager_only=True) result_pa = df.schema assert result_pa == expected assert {name: df[name].dtype for name in df.columns} == expected diff --git a/tests/hypothesis/test_basic_arithmetic.py b/tests/hypothesis/test_basic_arithmetic.py index 64210ed42..5d7bcf21f 100644 --- a/tests/hypothesis/test_basic_arithmetic.py +++ b/tests/hypothesis/test_basic_arithmetic.py @@ -39,8 +39,8 @@ def test_mean( "floats": floats, }, ) - df_nw1 = nw.DataFrame(df_pandas) - df_nw2 = nw.DataFrame(df_polars) + df_nw1 = nw.from_native(df_pandas, eager_only=True) + df_nw2 = nw.from_native(df_polars, eager_only=True) assert_allclose( nw.to_native(df_nw1.select(nw.col("integer").mean())), diff --git a/tests/hypothesis/test_join.py b/tests/hypothesis/test_join.py index b7759a1cb..093868494 100644 --- a/tests/hypothesis/test_join.py +++ b/tests/hypothesis/test_join.py @@ -50,14 +50,14 @@ def test_join( # pragma: no cover df_polars = pl.DataFrame(data) df_polars2 = pl.DataFrame(data) - df_pl = nw.DataFrame(df_polars) - other_pl = nw.DataFrame(df_polars2) + df_pl = nw.from_native(df_polars, eager_only=True) + other_pl = nw.from_native(df_polars2, eager_only=True) dframe_pl = df_pl.join(other_pl, left_on=cols, right_on=cols, how="inner") df_pandas = pd.DataFrame(data) df_pandas2 = pd.DataFrame(data) - df_pd = nw.DataFrame(df_pandas) - other_pd = nw.DataFrame(df_pandas2) + df_pd = nw.from_native(df_pandas, eager_only=True) + other_pd = nw.from_native(df_pandas2, eager_only=True) dframe_pd = df_pd.join(other_pd, left_on=cols, right_on=cols, how="inner") dframe_pd1 = nw.to_native(dframe_pl).to_pandas() @@ -95,14 +95,14 @@ def test_cross_join( # pragma: no cover df_polars = pl.DataFrame(data) df_polars2 = pl.DataFrame(data) - df_pl = nw.DataFrame(df_polars) - other_pl = nw.DataFrame(df_polars2) + df_pl = nw.from_native(df_polars, eager_only=True) + other_pl = nw.from_native(df_polars2, eager_only=True) dframe_pl = df_pl.join(other_pl, how="cross") df_pandas = pd.DataFrame(data) df_pandas2 = pd.DataFrame(data) - df_pd = nw.DataFrame(df_pandas) - other_pd = nw.DataFrame(df_pandas2) + df_pd = nw.from_native(df_pandas, eager_only=True) + other_pd = nw.from_native(df_pandas2, eager_only=True) dframe_pd = df_pd.join(other_pd, how="cross") dframe_pd1 = nw.to_native(dframe_pl).to_pandas()