Skip to content

Commit adf6849

Browse files
committed
Reduce 5k tests for 500 tests for test_no_sort_keep_na
1 parent 8d8415b commit adf6849

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

pandas/tests/groupby/test_groupby_dropna.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,20 @@ def test_groupby_drop_nan_with_multi_index():
394394
tm.assert_frame_equal(result, expected)
395395

396396

397-
# sequence_index enumerates all strings made up of x, y, z of length 4
398-
@pytest.mark.parametrize("sequence_index", range(3**4))
397+
# y >x and z is the missing value
398+
@pytest.mark.parametrize(
399+
"sequence",
400+
[
401+
"xyzy",
402+
"xxyz",
403+
"yzxz",
404+
"zzzz",
405+
"zyzx",
406+
"yyyy",
407+
"zzxy",
408+
"xyxy",
409+
],
410+
)
399411
@pytest.mark.parametrize(
400412
"dtype",
401413
[
@@ -419,15 +431,9 @@ def test_groupby_drop_nan_with_multi_index():
419431
],
420432
)
421433
@pytest.mark.parametrize("test_series", [True, False])
422-
def test_no_sort_keep_na(sequence_index, dtype, test_series, as_index):
434+
def test_no_sort_keep_na(sequence, dtype, test_series, as_index):
423435
# GH#46584, GH#48794
424436

425-
# Convert sequence_index into a string sequence, e.g. 5 becomes "xxyz"
426-
# This sequence is used for the grouper.
427-
sequence = "".join(
428-
[{0: "x", 1: "y", 2: "z"}[sequence_index // (3**k) % 3] for k in range(4)]
429-
)
430-
431437
# Unique values to use for grouper, depends on dtype
432438
if dtype in ("string", "string[pyarrow]"):
433439
uniques = {"x": "x", "y": "y", "z": pd.NA}

0 commit comments

Comments
 (0)