From db3a52cd575a345f89685a5c8f53276a59a7a225 Mon Sep 17 00:00:00 2001 From: Marshall Crumiller Date: Sun, 22 Sep 2024 18:24:52 -0400 Subject: [PATCH] Remove on from cross join tests --- py-polars/tests/unit/dataframe/test_df.py | 2 +- .../tests/unit/operations/test_cross_join.py | 2 +- .../unit/streaming/test_streaming_join.py | 20 ++++--------------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/py-polars/tests/unit/dataframe/test_df.py b/py-polars/tests/unit/dataframe/test_df.py index 7208f3d01048..8798dc89ed22 100644 --- a/py-polars/tests/unit/dataframe/test_df.py +++ b/py-polars/tests/unit/dataframe/test_df.py @@ -2145,7 +2145,7 @@ def test_join_suffixes() -> None: join_strategies: list[JoinStrategy] = ["left", "inner", "full", "cross"] for how in join_strategies: # no need for an assert, we error if wrong - df_a.join(df_b, on="A", suffix="_y", how=how)["B_y"] + df_a.join(df_b, on="A" if how != "cross" else None, suffix="_y", how=how)["B_y"] df_a.join_asof(df_b, on=pl.col("A").set_sorted(), suffix="_y")["B_y"] diff --git a/py-polars/tests/unit/operations/test_cross_join.py b/py-polars/tests/unit/operations/test_cross_join.py index ddd3d36b226b..94830371ed35 100644 --- a/py-polars/tests/unit/operations/test_cross_join.py +++ b/py-polars/tests/unit/operations/test_cross_join.py @@ -25,7 +25,7 @@ def test_cross_join_predicate_pushdown_block_16956() -> None: ).cast(pl.Datetime("ms", "Europe/Amsterdam")) assert ( - lf.join(lf, on="start_datetime", how="cross") + lf.join(lf, how="cross") .filter( pl.col.end_datetime_right.is_between( pl.col.start_datetime, pl.col.start_datetime.dt.offset_by("132h") diff --git a/py-polars/tests/unit/streaming/test_streaming_join.py b/py-polars/tests/unit/streaming/test_streaming_join.py index 074110076b28..cc09dde80cd0 100644 --- a/py-polars/tests/unit/streaming/test_streaming_join.py +++ b/py-polars/tests/unit/streaming/test_streaming_join.py @@ -103,26 +103,14 @@ def test_streaming_joins() -> None: def test_streaming_cross_join_empty() -> None: - df1 = pl.LazyFrame( - data={ - "col1": ["a"], - } - ) + df1 = pl.LazyFrame(data={"col1": ["a"]}) df2 = pl.LazyFrame( - data={ - "col1": [], - }, - schema={ - "col1": str, - }, + data={"col1": []}, + schema={"col1": str}, ) - out = df1.join( - df2, - how="cross", - on="col1", - ).collect(streaming=True) + out = df1.join(df2, how="cross").collect(streaming=True) assert out.shape == (0, 2) assert out.columns == ["col1", "col1_right"]