-
Notifications
You must be signed in to change notification settings - Fork 45
test_isdtype
#174
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
test_isdtype
#174
Conversation
@@ -174,6 +175,33 @@ def test_iinfo(dtype): | |||
# TODO: test values | |||
|
|||
|
|||
if api_version >= "2022.12": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I feel about nesting tests under if api_version
like this instead of just skipping them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, doesn't feel good. I (seemingly) have to do this for a test like test_conj
because we're using the >=2022.12
feature of Hypothesis xps.complex_dtypes()
,
array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py
Lines 927 to 934 in a533680
if api_version >= "2022.12": | |
@given(xps.arrays(dtype=xps.complex_dtypes(), shape=hh.shapes())) | |
def test_conj(x): | |
out = xp.conj(x) | |
ph.assert_dtype("conj", x.dtype, out.dtype) | |
ph.assert_shape("conj", out.shape, x.shape) | |
unary_assert_against_refimpl("conj", x, out, operator.methodcaller("conjugate")) |
so kinda just did this to be consistent with the pattern. But I think the ultimate goal with test_conj
/etc. would be to not use this pattern, so now skipping this test instead in my force-push.
expected = True | ||
break | ||
else: | ||
if dtype == _kind: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implicitly assumes dtype equality works, meaning if it's broken or incorrect this might not notice. You can see the test I added in my compat PR compare the known value using dtype string names. Maybe it isn't so important here since we also test dtype.__eq__
anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I think we're just out of luck if that's the case. Fortunately this would get checked via a sanity check I wrote in EqualityMapping
array-api-tests/array_api_tests/dtype_helpers.py
Lines 62 to 63 in a533680
if not (key == key): # specifically checking __eq__, not __neq__ | |
raise ValueError(f"Key {key!r} does not have equality with itself") |
If this passes my compat PR that sounds good to me. |
New territory here, but is currently passing for data-apis/array-api-compat#32