예제 #1
0
def test_numpy_compat(method):
    # see gh-12811
    e = ExponentialMovingWindow(Series([2, 4, 6]), alpha=0.5)

    msg = "numpy operations are not valid with window objects"

    with pytest.raises(UnsupportedFunctionCall, match=msg):
        getattr(e, method)(1, 2, 3)
    with pytest.raises(UnsupportedFunctionCall, match=msg):
        getattr(e, method)(dtype=np.float64)
예제 #2
0
파일: test_ewm.py 프로젝트: tnir/pandas
def test_numpy_compat(method):
    # see gh-12811
    e = ExponentialMovingWindow(Series([2, 4, 6]), alpha=0.5)

    error_msg = "numpy operations are not valid with window objects"

    warn_msg = f"Passing additional args to ExponentialMovingWindow.{method}"
    with tm.assert_produces_warning(FutureWarning, match=warn_msg):
        with pytest.raises(UnsupportedFunctionCall, match=error_msg):
            getattr(e, method)(1, 2, 3)
    warn_msg = f"Passing additional kwargs to ExponentialMovingWindow.{method}"
    with tm.assert_produces_warning(FutureWarning, match=warn_msg):
        with pytest.raises(UnsupportedFunctionCall, match=error_msg):
            getattr(e, method)(dtype=np.float64)