Add tests for cast from tuple to sequence containers (#3900)

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.
This commit is contained in:
Ed Catmur 2022-04-24 22:39:47 +01:00 committed by GitHub
parent 03252067db
commit 9bc2704430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ def test_vector(doc):
assert m.cast_bool_vector() == [True, False] assert m.cast_bool_vector() == [True, False]
assert m.load_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.cast_vector) == "cast_vector() -> List[int]"
assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool" assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool"
@ -36,6 +37,7 @@ def test_array(doc):
lst = m.cast_array() lst = m.cast_array()
assert lst == [1, 2] assert lst == [1, 2]
assert m.load_array(lst) assert m.load_array(lst)
assert m.load_array(tuple(lst))
assert doc(m.cast_array) == "cast_array() -> List[int[2]]" assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool" assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
@ -46,6 +48,7 @@ def test_valarray(doc):
lst = m.cast_valarray() lst = m.cast_valarray()
assert lst == [1, 4, 9] assert lst == [1, 4, 9]
assert m.load_valarray(lst) assert m.load_valarray(lst)
assert m.load_valarray(tuple(lst))
assert doc(m.cast_valarray) == "cast_valarray() -> List[int]" assert doc(m.cast_valarray) == "cast_valarray() -> List[int]"
assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool" assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"