MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_vector

Function test_vector

tests/test_stl.py:10–29  ·  view source on GitHub ↗

std::vector <-> list

(doc)

Source from the content-addressed store, hash-verified

8
9
10def test_vector(doc):
11 """std::vector <-> list"""
12 lst = m.cast_vector()
13 assert lst == [1]
14 lst.append(2)
15 assert m.load_vector(lst)
16 assert m.load_vector(tuple(lst))
17
18 assert m.cast_bool_vector() == [True, False]
19 assert m.load_bool_vector([True, False])
20 assert m.load_bool_vector((True, False))
21
22 assert doc(m.cast_vector) == "cast_vector() -> list[int]"
23 assert (
24 doc(m.load_vector)
25 == "load_vector(arg0: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> bool"
26 )
27
28 # Test regression caused by 936: pointers to stl containers weren't castable
29 assert m.cast_ptr_vector() == ["lvalue", "lvalue"]
30
31
32def test_deque():

Callers

nothing calls this directly

Calls 3

tupleClass · 0.85
docFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected