From a46c1c8efa0929e5b9cad75c28ffa473a1f15e36 Mon Sep 17 00:00:00 2001 From: "samuel.oranyeli" Date: Sat, 20 Jul 2024 01:28:26 +1000 Subject: [PATCH] add extra test for polars expand --- tests/polars/functions/test_expand_polars.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/polars/functions/test_expand_polars.py b/tests/polars/functions/test_expand_polars.py index f4d0f4aad..9fcd5ff3e 100644 --- a/tests/polars/functions/test_expand_polars.py +++ b/tests/polars/functions/test_expand_polars.py @@ -43,3 +43,11 @@ def test_expand_1(df): """ Test output for janitor.expand. """ + expected = df.expand("group", "item_id", "item_name", sort=True) + actual = ( + df.select(pl.col("group").unique()) + .join(df.select(pl.col("item_id").unique()), how="cross") + .join(df.select(pl.col("item_name").unique()), how="cross") + .sort(by=pl.all()) + ) + assert_frame_equal(actual, expected)