-
Notifications
You must be signed in to change notification settings - Fork 97
Closes #5285: alignment tests for arkouda.numpy.sorting #5286
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
base: main
Are you sure you want to change the base?
Closes #5285: alignment tests for arkouda.numpy.sorting #5286
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5286 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 4
Lines ? 63
Branches ? 0
========================================
Hits ? 63
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| rng = np.random.default_rng(seed) | ||
| if dtype == np.float64: | ||
| # Avoid NaNs/Infs for clean alignment expectations | ||
| x = rng.normal(size=shape).astype(np.float64) |
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.
As far as I know (and I did a manual test), numpy normal returns np.float64. The astype(np.float64) isn't needed.
| a_np = _make_np_array(dtype, shape, seed=123) | ||
| a_ak = ak.array(a_np) | ||
|
|
||
| # Arkouda normalizes axis, so compute the equivalent for NumPy |
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 code implies that either numpy or arkouda can't handle a negative axis, but that's not correct. If you set axis_np to axis, and comment out lines 48 through 56, the test still passes.
Add NumPy Alignment Tests for Sorting APIs
Summary
This PR adds a new NumPy alignment test suite for Arkouda sorting-related APIs. The goal is to ensure Arkouda behavior matches NumPy semantics across supported dtypes, shapes, axes, and edge cases.
What’s Included
tests/numpy/alignment_verification/sorting_alignment.pypytest.iniso it runs as part of the standard test suiteAPIs Covered
The new alignment tests compare Arkouda results directly against NumPy for:
ak.sortak.argsort(ascending and descending, stable behavior)ak.coargsort(validated againstnp.lexsortsemantics)ak.searchsortedside='left'and'right'x2_sorted=True/FalseTest Matrix
int64,uint64,float640,-1@pytest.mark.skip_if_rank_not_compiledused where multi-dimensional support depends on server configurationNotable Details
argsortto ensure deterministic alignment for equal keys.np.uint64) forsearchsortedto match Arkouda’s strict dtype checks.argsortpermutations actually sorts the data.Motivation
This brings sorting APIs up to the same NumPy-alignment standard as existing operator and manipulation tests, strengthening confidence in Arkouda’s NumPy compatibility and catching regressions early.
Closes #5285: alignment tests for arkouda.numpy.sorting