Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed Sep 21, 2023
1 parent 77d60f9 commit 7eb4bb7
Showing 1 changed file with 38 additions and 17 deletions.
55 changes: 38 additions & 17 deletions modin/pandas/test/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# governing permissions and limitations under the License.

import contextlib
import warnings

import numpy as np
import pandas
Expand Down Expand Up @@ -147,7 +148,8 @@ def test_dataframe_agg(data, window, min_periods, axis):
)
with catch_rolling_numpy_callable_future_depr():
pandas_res = pandas_rolled.aggregate(np.sum)
# TODO: with catch_rolling_numpy_callable_future_depr():
# FIXME: modin doesn't have warning for the case so we can't use
# `catch_rolling_numpy_callable_future_depr`.
modin_res = modin_rolled.aggregate(np.sum)
df_equals(pandas_res, modin_res)
# TODO(https://github.com/modin-project/modin/issues/4260): Once pandas
Expand All @@ -156,7 +158,8 @@ def test_dataframe_agg(data, window, min_periods, axis):
if axis != 1:
with catch_rolling_numpy_callable_future_depr():
pandas_res = pandas_rolled.aggregate([np.sum, np.mean])
# TODO: add with catch_rolling_numpy_callable_future_depr():
# FIXME: modin doesn't have warning for the case so we can't use
# `catch_rolling_numpy_callable_future_depr`.
modin_res = modin_rolled.aggregate([np.sum, np.mean])
df_equals(pandas_res, modin_res)

Expand Down Expand Up @@ -251,7 +254,8 @@ def test_dataframe_dt_index(axis, on, closed, window):
pandas_rolled.apply(np.sum, raw=True),
)

# TODO: add with catch_rolling_numpy_callable_future_depr():
# FIXME: modin doesn't have warning for the case so we can't use
# `catch_rolling_numpy_callable_future_depr`.
modin_res = modin_rolled.aggregate(np.sum)
with catch_rolling_numpy_callable_future_depr():
pandas_res = pandas_rolled.aggregate(np.sum)
Expand Down Expand Up @@ -289,19 +293,28 @@ def test_series_rolling(data, window, min_periods, method, kwargs):
modin_series, pandas_series = create_test_series(data)
if window > len(pandas_series):
window = len(pandas_series)
eval_general(
modin_series,
pandas_series,
lambda series: getattr(
series.rolling(
window=window,
min_periods=min_periods,
win_type=None,
center=True,
),
method,
)(**kwargs),
)

# FIXME: modin doesn't have warning for the case so we can't use
# `catch_rolling_numpy_callable_future_depr`.
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message=".*The provided callable.*pass .* instead.",
category=FutureWarning,
)
eval_general(
modin_series,
pandas_series,
lambda series: getattr(
series.rolling(
window=window,
min_periods=min_periods,
win_type=None,
center=True,
),
method,
)(**kwargs),
)


@pytest.mark.parametrize("data", test_data_values, ids=test_data_keys)
Expand Down Expand Up @@ -371,7 +384,15 @@ def test_series_dt_index(closed):
df_equals(
modin_rolled.apply(np.sum, raw=True), pandas_rolled.apply(np.sum, raw=True)
)
df_equals(modin_rolled.aggregate(np.sum), pandas_rolled.aggregate(np.sum))
# FIXME: modin doesn't have warning for the case so we can't use
# `catch_rolling_numpy_callable_future_depr`.
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message=".*The provided callable.*pass .* instead.",
category=FutureWarning,
)
df_equals(modin_rolled.aggregate(np.sum), pandas_rolled.aggregate(np.sum))
df_equals(modin_rolled.quantile(0.1), pandas_rolled.quantile(0.1))


Expand Down

0 comments on commit 7eb4bb7

Please sign in to comment.