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