pyo3/pytests/pyo3-pytests/tests/test_pyclass_iter.py

16 lines
335 B
Python
Raw Normal View History

import pytest
from pyo3_pytests import pyclass_iter
def test_iter():
i = pyclass_iter.PyClassIter()
assert next(i) == 1
assert next(i) == 2
assert next(i) == 3
assert next(i) == 4
assert next(i) == 5
with pytest.raises(StopIteration) as excinfo:
next(i)
assert excinfo.value.value == "Ended"