mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-27 02:09:13 +00:00
feature: Use typed iterators in make_*iterator (#4876)
This commit is contained in:
@@ -58,6 +58,15 @@ def test_generalized_iterators_simple():
|
||||
assert list(m.IntPairs([(1, 2), (3, 4), (0, 5)]).simple_values()) == [2, 4, 5]
|
||||
|
||||
|
||||
def test_iterator_doc_annotations():
|
||||
assert m.IntPairs.nonref.__doc__.endswith("-> Iterator[tuple[int, int]]\n")
|
||||
assert m.IntPairs.nonref_keys.__doc__.endswith("-> Iterator[int]\n")
|
||||
assert m.IntPairs.nonref_values.__doc__.endswith("-> Iterator[int]\n")
|
||||
assert m.IntPairs.simple_iterator.__doc__.endswith("-> Iterator[tuple[int, int]]\n")
|
||||
assert m.IntPairs.simple_keys.__doc__.endswith("-> Iterator[int]\n")
|
||||
assert m.IntPairs.simple_values.__doc__.endswith("-> Iterator[int]\n")
|
||||
|
||||
|
||||
def test_iterator_referencing():
|
||||
"""Test that iterators reference rather than copy their referents."""
|
||||
vec = m.VectorNonCopyableInt()
|
||||
|
||||
Reference in New Issue
Block a user