Skip to content

Commit 9df353b

Browse files
committed
Add nunique to an additional set of pivot tests
1 parent e81d9b4 commit 9df353b

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

tests/integ/modin/pivot/test_pivot_table_dropna.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_pivot_table_single_all_aggfuncs_dropna_and_null_data(
107107
df_data_with_nulls_2,
108108
values,
109109
):
110-
expected_join_count = 10 if len(values) > 1 else 5
110+
expected_join_count = 12 if len(values) > 1 else 6
111111
with SqlCounter(query_count=1, join_count=expected_join_count):
112112
pivot_table_test_helper(
113113
df_data_with_nulls_2,
@@ -116,7 +116,7 @@ def test_pivot_table_single_all_aggfuncs_dropna_and_null_data(
116116
"columns": ["C"],
117117
"values": values,
118118
"dropna": False,
119-
"aggfunc": ["count", "sum", "min", "max", "mean"],
119+
"aggfunc": ["count", "sum", "min", "max", "mean", "nunique"],
120120
},
121121
)
122122

tests/integ/modin/pivot/test_pivot_table_margins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_pivot_table_multiple_columns_values_with_margins(
134134
),
135135
],
136136
)
137-
@sql_count_checker(query_count=1, join_count=5, union_count=1)
137+
@sql_count_checker(query_count=1, join_count=6, union_count=1)
138138
def test_pivot_table_multiple_pivot_values_null_data_with_margins(
139139
df_data_with_nulls, index, fill_value
140140
):
@@ -144,7 +144,7 @@ def test_pivot_table_multiple_pivot_values_null_data_with_margins(
144144
"index": index,
145145
"columns": "C",
146146
"values": "F",
147-
"aggfunc": ["count", "sum", "mean"],
147+
"aggfunc": ["count", "sum", "mean", "nunique"],
148148
"dropna": False,
149149
"fill_value": fill_value,
150150
"margins": True,

tests/integ/modin/pivot/test_pivot_table_multiple.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ def test_pivot_table_no_index_single_column_multiple_values(df_data):
3838
)
3939

4040

41-
@sql_count_checker(query_count=1, union_count=1, join_count=2)
41+
@sql_count_checker(query_count=1, union_count=1, join_count=4)
4242
def test_pivot_table_no_index_single_column_multiple_values_multiple_aggr_func(df_data):
4343
pivot_table_test_helper(
4444
df_data,
4545
{
4646
"columns": "B",
4747
"values": ["D", "E"],
48-
"aggfunc": ["mean", "max"],
48+
"aggfunc": ["mean", "max", "nunique"],
4949
},
5050
)
5151

@@ -119,7 +119,7 @@ def test_pivot_table_single_index_multiple_column_single_value(
119119
)
120120

121121

122-
@pytest.mark.parametrize("aggfunc", ["count", "sum", "min", "max", "mean"])
122+
@pytest.mark.parametrize("aggfunc", ["count", "sum", "min", "max", "mean", "nunique"])
123123
@pytest.mark.parametrize("values", ["D", ["D"]])
124124
@sql_count_checker(query_count=1)
125125
def test_pivot_table_no_index_multiple_column_single_value(df_data, aggfunc, values):

tests/integ/modin/pivot/test_pivot_table_single.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def test_pivot_table_no_index_single_column_single_value(df_data):
5454
np.std,
5555
"var",
5656
np.var,
57+
"nunique",
5758
),
5859
)
5960
@sql_count_checker(query_count=1)
@@ -77,6 +78,7 @@ def test_pivot_table_single_index_single_column_single_value(df_data, aggfunc):
7778
"min",
7879
"max",
7980
"mean",
81+
"nunique",
8082
],
8183
)
8284
@sql_count_checker(query_count=1)
@@ -95,6 +97,7 @@ def test_pivot_table_multi_index_single_column_single_value(df_data, aggfunc):
9597
"min",
9698
"max",
9799
"mean",
100+
"nunique",
98101
],
99102
)
100103
@sql_count_checker(query_count=1)
@@ -201,6 +204,7 @@ def test_pivot_table_with_duplicate_values(
201204
[
202205
"count",
203206
"sum",
207+
"nunique",
204208
],
205209
)
206210
@pytest.mark.parametrize(
@@ -228,6 +232,7 @@ def test_pivot_table_with_sum_and_count_null_and_empty_values_matching_behavior(
228232
[
229233
"count",
230234
"sum",
235+
"nunique",
231236
],
232237
)
233238
def test_pivot_table_with_sum_and_count_null_and_empty_values_matching_behavior_skipped(

0 commit comments

Comments
 (0)