28 lines
507 B
Python
28 lines
507 B
Python
import pytest
|
|
from pyo3_pytests import pyclasses
|
|
|
|
|
|
def test_empty_class_init(benchmark):
|
|
benchmark(pyclasses.EmptyClass)
|
|
|
|
|
|
class EmptyClassPy:
|
|
pass
|
|
|
|
|
|
def test_empty_class_init_py(benchmark):
|
|
benchmark(EmptyClassPy)
|
|
|
|
|
|
def test_iter():
|
|
i = pyclasses.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"
|