2020-06-23 10:35:02 +00:00
|
|
|
import pytest
|
2021-04-01 23:03:49 +00:00
|
|
|
from pyo3_pytests import pyclass_iter
|
2020-06-23 10:35:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
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"
|