Skip to content

Commit 9fd89dc

Browse files
committed
Test that iteration raises NotImplemented
1 parent fe9e310 commit 9fd89dc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pandas/tests/test_window.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ def win_types_special(request):
4646
return request.param
4747

4848

49+
# Issue 11704: Iteration over a Window
50+
51+
@pytest.fixture
52+
def series():
53+
return pd.Series([1, 2, 3, 4])
54+
55+
@pytest.fixture
56+
def frame():
57+
return pd.DataFrame({'a': [1, 2, 3, 4], 'b': [10, 20, 30, 40]})
58+
59+
@pytest.mark.parametrize('which', [series(), frame()])
60+
def test_rolling_iterator(which):
61+
with pytest.raises(NotImplementedError):
62+
iter(which.rolling(2))
63+
64+
@pytest.mark.parametrize('which', [series(), frame()])
65+
def test_expanding_iterator(which):
66+
with pytest.raises(NotImplementedError):
67+
iter(which.expanding())
68+
69+
4970
class Base(object):
5071

5172
_nan_locs = np.arange(20, 40)

0 commit comments

Comments
 (0)