/usr/local/lib64/python3.6/site-packages/pandas/tests/window
NameSizeModeActions
__pycache__/-0755rm
common.py61390644editdlrm
conftest.py74090644editdlrm
test_api.py104290644editdlrm
test_apply.py52700644editdlrm
test_base_indexer.py81610644editdlrm
test_dtypes.py73390644editdlrm
test_ewm.py40870644editdlrm
test_expanding.py71180644editdlrm
test_grouper.py193140644editdlrm
test_numba.py29420644editdlrm
test_pairwise.py84050644editdlrm
test_rolling.py216930644editdlrm
test_timeseries_window.py249050644editdlrm
test_window.py20330644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/tests/window/test_window.py (2033B)
import numpy as np import pytest from pandas.errors import UnsupportedFunctionCall import pandas.util._test_decorators as td import pandas as pd from pandas import Series from pandas.core.window import Window @td.skip_if_no_scipy def test_constructor(which): # GH 12669 c = which.rolling # valid c(win_type="boxcar", window=2, min_periods=1) c(win_type="boxcar", window=2, min_periods=1, center=True) c(win_type="boxcar", window=2, min_periods=1, center=False) # not valid for w in [2.0, "foo", np.array([2])]: with pytest.raises(ValueError, match="min_periods must be an integer"): c(win_type="boxcar", window=2, min_periods=w) with pytest.raises(ValueError, match="center must be a boolean"): c(win_type="boxcar", window=2, min_periods=1, center=w) for wt in ["foobar", 1]: with pytest.raises(ValueError, match="Invalid win_type"): c(win_type=wt, window=2) @td.skip_if_no_scipy def test_constructor_with_win_type(which, win_types): # GH 12669 c = which.rolling c(win_type=win_types, window=2) @pytest.mark.parametrize("method", ["sum", "mean"]) def test_numpy_compat(method): # see gh-12811 w = Window(Series([2, 4, 6]), window=[0, 2]) msg = "numpy operations are not valid with window objects" with pytest.raises(UnsupportedFunctionCall, match=msg): getattr(w, method)(1, 2, 3) with pytest.raises(UnsupportedFunctionCall, match=msg): getattr(w, method)(dtype=np.float64) @td.skip_if_no_scipy @pytest.mark.parametrize("arg", ["median", "kurt", "skew"]) def test_agg_function_support(arg): df = pd.DataFrame({"A": np.arange(5)}) roll = df.rolling(2, win_type="triang") msg = f"'{arg}' is not a valid function for 'Window' object" with pytest.raises(AttributeError, match=msg): roll.agg(arg) with pytest.raises(AttributeError, match=msg): roll.agg([arg]) with pytest.raises(AttributeError, match=msg): roll.agg({"A": arg})