Skip to content

Commit 20041d5

Browse files
committed
Extend _test_signature doc
1 parent 7493ff8 commit 20041d5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

array_api_tests/test_signatures.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@ def _test_signature(
3131
def add(x1, x2, /):
3232
...
3333
34-
x1 and x2 don't need to be pos-only for the purposes of interoperability.
34+
x1 and x2 don't need to be pos-only for the purposes of interoperability, but with
35+
36+
def squeeze(x, /, axis):
37+
...
38+
39+
axis has to be pos-or-keyword to support both styles
40+
41+
>>> squeeze(x, 0)
42+
...
43+
>>> squeeze(x, axis=0)
44+
...
45+
3546
"""
3647
try:
3748
sig = signature(func)
@@ -73,7 +84,7 @@ def add(x1, x2, /):
7384
):
7485
pytest.skip(
7586
f"faulty spec - argument {stub_param.name} should be a "
76-
f"{kind_to_str[Parameter.POSITIONAL_OR_KEYWORD]}"
87+
f"{kind_to_str[Parameter.POSITIONAL_ONLY]}"
7788
)
7889
f_kind = kind_to_str[param.kind]
7990
f_stub_kind = kind_to_str[stub_param.kind]

0 commit comments

Comments
 (0)