From 3d5ce516d26007ac3a804bc5a04c9aca9309d432 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Thu, 27 Aug 2020 19:14:09 +0300 Subject: [PATCH] TEST-#1961: speed up test_sum Signed-off-by: Anatoly Myachev --- modin/pandas/test/test_dataframe.py | 47 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/modin/pandas/test/test_dataframe.py b/modin/pandas/test/test_dataframe.py index 4bcec77ea0c..c1d1a7618da 100644 --- a/modin/pandas/test/test_dataframe.py +++ b/modin/pandas/test/test_dataframe.py @@ -3321,34 +3321,39 @@ def test_prod( min_count=min_count, ) - @pytest.mark.parametrize( - "data", - test_data_values + test_data_small_values, - ids=test_data_keys + test_data_small_keys, - ) - @pytest.mark.parametrize("axis", axis_values, ids=axis_keys) + @pytest.mark.parametrize("is_transposed", [False, True]) @pytest.mark.parametrize( "skipna", bool_arg_values, ids=arg_keys("skipna", bool_arg_keys) ) + @pytest.mark.parametrize("axis", axis_values, ids=axis_keys) + @pytest.mark.parametrize("data", [test_data["dense_nan_data"]]) + def test_sum(self, data, axis, skipna, is_transposed): + eval_general( + *create_test_dfs(data), + lambda df: (df.T if is_transposed else df).sum( + axis=axis, + skipna=skipna, + ), + ) + @pytest.mark.parametrize( - "numeric_only", bool_arg_values, ids=arg_keys("numeric_only", bool_arg_keys) - ) - @pytest.mark.parametrize( - "min_count", int_arg_values, ids=arg_keys("min_count", int_arg_keys) + "numeric_only", + [ + pytest.param(None, marks=pytest.mark.xfail(reason="See #1976 for details")), + False, + True, + ], ) - @pytest.mark.parametrize("is_transposed", [False, True]) - def test_sum( - self, request, data, axis, skipna, numeric_only, min_count, is_transposed - ): + @pytest.mark.parametrize("min_count", int_arg_values) + def test_sum_specific(self, min_count, numeric_only): + data = { + "float_col": [np.NaN, 9.4, 10.1, np.NaN], + "str_col": ["a", np.NaN, "c", "d"], + "bool_col": [False, True, True, False], + } eval_general( *create_test_dfs(data), - lambda df, *args, **kwargs: (df.T if is_transposed else df).sum( - *args, **kwargs - ), - axis=axis, - skipna=skipna, - numeric_only=numeric_only, - min_count=min_count, + lambda df: df.sum(min_count=min_count, numeric_only=numeric_only), ) @pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)