Skip to content

Commit f17781a

Browse files
committed
test: Include None in partitions
- Already works, but I wanna add some optimizations for the single partition case - `pc.unique` can be used directly on a lot of `ChunkedArray` types, but `filter` will drop nulls by default, so needs some care if present
1 parent 2bffdaa commit f17781a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/plan/frame_partition_by_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616

1717
@pytest.fixture
1818
def data() -> Data:
19-
return {"a": ["a", "b", "a", "b", "c"], "b": [1, 2, 1, 3, 3], "c": [5, 4, 3, 2, 1]}
19+
return {
20+
"a": ["a", "b", "a", None, "b", "c"],
21+
"b": [1, 2, 1, 5, 3, 3],
22+
"c": [5, 4, 3, 6, 2, 1],
23+
}
2024

2125

2226
@pytest.mark.parametrize(
@@ -27,6 +31,7 @@ def data() -> Data:
2731
[
2832
{"a": ["a", "a"], "b": [1, 1], "c": [5, 3]},
2933
{"a": ["b", "b"], "b": [2, 3], "c": [4, 2]},
34+
{"a": [None], "b": [5], "c": [6]},
3035
{"a": ["c"], "b": [3], "c": [1]},
3136
],
3237
),
@@ -35,6 +40,7 @@ def data() -> Data:
3540
[
3641
{"b": [1, 1], "c": [5, 3]},
3742
{"b": [2, 3], "c": [4, 2]},
43+
{"b": [5], "c": [6]},
3844
{"b": [3], "c": [1]},
3945
],
4046
),
@@ -63,11 +69,12 @@ def test_partition_by_single(
6369
[
6470
{"a": ["a", "a"], "b": [1, 1], "c": [5, 3]},
6571
{"a": ["b"], "b": [2], "c": [4]},
72+
{"a": [None], "b": [5], "c": [6]},
6673
{"a": ["b"], "b": [3], "c": [2]},
6774
{"a": ["c"], "b": [3], "c": [1]},
6875
],
6976
),
70-
(False, [{"c": [5, 3]}, {"c": [4]}, {"c": [2]}, {"c": [1]}]),
77+
(False, [{"c": [5, 3]}, {"c": [4]}, {"c": [6]}, {"c": [2]}, {"c": [1]}]),
7178
],
7279
ids=["include_key", "exclude_key"],
7380
)

0 commit comments

Comments
 (0)