-
Notifications
You must be signed in to change notification settings - Fork 1
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
TST: test/fix astype
/clip
#20
Conversation
datas = [getattr(arg, 'data', arg) for arg in args] | ||
data = xp.clip(datas[0], min=datas[1], max=datas[2]) | ||
return MaskedArray(data, mask) | ||
mod.clip = clip |
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 should be done in a new PR, but I believe it would be neater to use a decorator for this
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.
You mean for adding the attribute to the namespace? What is the advantage?
marray/tests/test_marray.py
Outdated
marrays, masked_arrays, seed = get_arrays(1, dtype=dtype_in, seed=seed) | ||
|
||
if dtype_in != dtype_out and not copy: | ||
pytest.mark.skip("Can't change type without copy.") |
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.
does this actually do anything? I believe we need to use pytest.skip
instead:
pytest.mark.skip("Can't change type without copy.") | |
pytest.skip(reason="Can't change type without copy.") |
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.
No, it was a typo, and I guess it wasn't needed. Removed.
Interesting - the test caught what is arguably an edge case bug in NumPy's masked arrays: np.any(np.ma.masked_array([-1], mask=[True])).dtype # dtype('float64') I guess it's because:
TBH I think Anyway, the test failure does not indicate a bug in this PR, so nothing to fix here. If this comes up frequently, we can adjust the way the reference of that test is computed, but in the meantime there are better ways to spend time. |
@@ -521,11 +521,39 @@ def test_searchsorted(side, xp=strict, seed=None): | |||
# Test Linear Algebra functions | |||
|
|||
# Use Array API tests to test the following: | |||
# Data Type Functions (only `astype` remains to be tested) | |||
# Elementwise function `clip` (all others are tested above) | |||
# Creation Functions (same behavior but with all-False mask) |
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.
# Creation Functions (same behavior but with all-False mask) |
Grouping these two because because it was convenient to do so. Pretty straightforward.