@@ -20,7 +20,9 @@ def test_vector(doc):
20
20
assert m .load_bool_vector ((True , False ))
21
21
22
22
assert doc (m .cast_vector ) == "cast_vector() -> list[int]"
23
- assert doc (m .load_vector ) == "load_vector(arg0: list[int]) -> bool"
23
+ assert (
24
+ doc (m .load_vector ) == "load_vector(arg0: collections.abc.Sequence[int]) -> bool"
25
+ )
24
26
25
27
# Test regression caused by 936: pointers to stl containers weren't castable
26
28
assert m .cast_ptr_vector () == ["lvalue" , "lvalue" ]
@@ -45,7 +47,7 @@ def test_array(doc):
45
47
assert doc (m .cast_array ) == "cast_array() -> Annotated[list[int], FixedSize(2)]"
46
48
assert (
47
49
doc (m .load_array )
48
- == "load_array(arg0: Annotated[list [int], FixedSize(2)]) -> bool"
50
+ == "load_array(arg0: Annotated[collections.abc.Sequence [int], FixedSize(2)]) -> bool"
49
51
)
50
52
51
53
@@ -64,7 +66,10 @@ def test_valarray(doc):
64
66
assert m .load_valarray (tuple (lst ))
65
67
66
68
assert doc (m .cast_valarray ) == "cast_valarray() -> list[int]"
67
- assert doc (m .load_valarray ) == "load_valarray(arg0: list[int]) -> bool"
69
+ assert (
70
+ doc (m .load_valarray )
71
+ == "load_valarray(arg0: collections.abc.Sequence[int]) -> bool"
72
+ )
68
73
69
74
70
75
def test_map (doc ):
@@ -77,7 +82,9 @@ def test_map(doc):
77
82
assert m .load_map (d )
78
83
79
84
assert doc (m .cast_map ) == "cast_map() -> dict[str, str]"
80
- assert doc (m .load_map ) == "load_map(arg0: dict[str, str]) -> bool"
85
+ assert (
86
+ doc (m .load_map ) == "load_map(arg0: collections.abc.Mapping[str, str]) -> bool"
87
+ )
81
88
82
89
83
90
def test_set (doc ):
@@ -89,7 +96,7 @@ def test_set(doc):
89
96
assert m .load_set (frozenset (s ))
90
97
91
98
assert doc (m .cast_set ) == "cast_set() -> set[str]"
92
- assert doc (m .load_set ) == "load_set(arg0: set [str]) -> bool"
99
+ assert doc (m .load_set ) == "load_set(arg0: collections.abc.Set [str]) -> bool"
93
100
94
101
95
102
def test_recursive_casting ():
@@ -271,7 +278,7 @@ def __fspath__(self):
271
278
assert m .parent_paths (["foo/bar" , "foo/baz" ]) == [Path ("foo" ), Path ("foo" )]
272
279
assert (
273
280
doc (m .parent_paths )
274
- == "parent_paths(arg0: list [Union[os.PathLike, str, bytes]]) -> list[pathlib.Path]"
281
+ == "parent_paths(arg0: collections.abc.Sequence [Union[os.PathLike, str, bytes]]) -> list[pathlib.Path]"
275
282
)
276
283
# py::typing::List
277
284
assert m .parent_paths_list (["foo/bar" , "foo/baz" ]) == [Path ("foo" ), Path ("foo" )]
@@ -361,7 +368,7 @@ def test_stl_pass_by_pointer(msg):
361
368
msg (excinfo .value )
362
369
== """
363
370
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
364
- 1. (v: list [int] = None) -> list[int]
371
+ 1. (v: collections.abc.Sequence [int] = None) -> list[int]
365
372
366
373
Invoked with:
367
374
"""
@@ -373,7 +380,7 @@ def test_stl_pass_by_pointer(msg):
373
380
msg (excinfo .value )
374
381
== """
375
382
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
376
- 1. (v: list [int] = None) -> list[int]
383
+ 1. (v: collections.abc.Sequence [int] = None) -> list[int]
377
384
378
385
Invoked with: None
379
386
"""
0 commit comments