Skip to content

Commit 2131292

Browse files
author
abessen
committed
Test that after exception is thrown iterator is no longer valid
1 parent a1bb354 commit 2131292

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/tests/test_exceptions.py

+9
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ def test_iteration_exception():
362362

363363
assert exc == exception
364364

365+
# after exception is thrown iterator is no longer valid
366+
with pytest.raises(StopIteration):
367+
next(val)
368+
369+
365370
def test_iteration_innerexception():
366371
from Python.Test import ExceptionTest
367372
from System import OverflowException
@@ -377,3 +382,7 @@ def test_iteration_innerexception():
377382
exc = cm.value
378383

379384
assert exc == exception.InnerException
385+
386+
# after exception is thrown iterator is no longer valid
387+
with pytest.raises(StopIteration):
388+
next(val)

0 commit comments

Comments
 (0)