Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify/infer arguments for testing uninspectable signatures #177

Merged
merged 4 commits into from
Apr 27, 2023

Conversation

honno
Copy link
Member

@honno honno commented Apr 11, 2023

Should resolve #175 by re-introducing manual specification of arguments when testing uninspectable signatures.

Differences with pre-#110 test_signatures.py:

  • Declarative approach to specifying manual arguments.
    • Arguments are explicitly specified for the functions/methods that use them, preventing assumptions leaking.
  • Leverages inspect.Parameter.default to infer the majority of manual arguments.
  • Tests all valid combinations of passing pos-or-kw arguments

@honno honno marked this pull request as ready for review April 19, 2023 12:52
@honno honno requested a review from asmeurer April 19, 2023 12:58
@honno
Copy link
Member Author

honno commented Apr 19, 2023

@asmeurer here are the current failures for array_api_compat.torch, which all look to be failing correctly. No function/method is being skipped now!

# dims (axes in torch) can't be a single int
array_api_tests/test_signatures.py::test_func_signature[permute_dims]
# no copy arg
array_api_tests/test_signatures.py::test_func_signature[reshape]
# shape is pos-only (should be pos-or-kw)
array_api_tests/test_signatures.py::test_func_signature[broadcast_to]
# no k arg (diagonal is used instead)
array_api_tests/test_signatures.py::test_func_signature[tril]
array_api_tests/test_signatures.py::test_func_signature[triu]
# methods don't exist
array_api_tests/test_signatures.py::test_array_method_signature[__array_namespace__]
array_api_tests/test_signatures.py::test_array_method_signature[to_device]
# not in linalg extension
array_api_tests/test_signatures.py::test_extension_func_signature[linalg.matrix_transpose]
array_api_tests/test_signatures.py::test_extension_func_signature[linalg.outer]
array_api_tests/test_signatures.py::test_extension_func_signature[linalg.tensordot]
array_api_tests/test_signatures.py::test_extension_func_signature[linalg.trace]

@honno
Copy link
Member Author

honno commented Apr 27, 2023

This is nice to get in so merging.

@honno honno merged commit c2c6a9f into data-apis:master Apr 27, 2023
@honno honno deleted the fallback-signature-tests branch February 28, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signature tests not catching missing keyword arguments
1 participant