Skip to content

Commit

Permalink
Add tests for cast from tuple to sequence containers (#3900)
Browse files Browse the repository at this point in the history
We already test that tuple can cast to std::vector and std::deque; add tests for std::vector<bool>, std::list and
std::valarray.

Extracted from #3886.
  • Loading branch information
ecatmur authored Apr 24, 2022
1 parent 0325206 commit 9bc2704
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def test_vector(doc):

assert m.cast_bool_vector() == [True, False]
assert m.load_bool_vector([True, False])
assert m.load_bool_vector(tuple([True, False]))

assert doc(m.cast_vector) == "cast_vector() -> List[int]"
assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool"
Expand All @@ -36,6 +37,7 @@ def test_array(doc):
lst = m.cast_array()
assert lst == [1, 2]
assert m.load_array(lst)
assert m.load_array(tuple(lst))

assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
Expand All @@ -46,6 +48,7 @@ def test_valarray(doc):
lst = m.cast_valarray()
assert lst == [1, 4, 9]
assert m.load_valarray(lst)
assert m.load_valarray(tuple(lst))

assert doc(m.cast_valarray) == "cast_valarray() -> List[int]"
assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"
Expand Down

0 comments on commit 9bc2704

Please sign in to comment.