Avoid calling hh.arrays with dtype=None for complex types #313
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue description
ndonnx does not (yet) support complex data types. We signal that by setting
ARRAY_API_TESTS_SKIP_DTYPES="complex64,complex128"
. During the collection phasehypothesis_helpers.complex_dtypes
is set toNone
. However, downstream calls tohypothesis_helpers.arrays
appear to not be able to handledtype=None
as an argument, ultimately leading to an error when looking up the data type such as:Since data types are looked up using
__eq__
things appear to work if any of the data types compare equal toNone
which is the case fornumpy.dtype("float64")
, for example.Solution
This PR simply guards each affected tests (i.e. tests that work on
hypothesis_helpers.complex_dtypes
) with a respective if statement. This works just fine in practice for us, but I'm sure there is a better fix out there. I tried to setcomplex_dtypes = ()
, which seems reasonable, but that lead to other errors.