pyo3/examples/rustapi_module/tests/test_pyclass_iter.py
2020-06-23 15:26:28 +01:00

16 lines
337 B
Python

import pytest
from rustapi_module 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"