Skip to content

Conversation

@ajpotts
Copy link
Contributor

@ajpotts ajpotts commented Jan 9, 2026

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

  • New test module: tests/numpy/alignment_verification/sorting_alignment.py
  • Registration of the new module in pytest.ini so it runs as part of the standard test suite

APIs Covered

The new alignment tests compare Arkouda results directly against NumPy for:

  • ak.sort
  • ak.argsort (ascending and descending, stable behavior)
  • ak.coargsort (validated against np.lexsort semantics)
  • ak.searchsorted
    • scalar and vector inputs
    • side='left' and 'right'
    • x2_sorted=True/False
    • dtype mismatch and invalid shape handling

Test Matrix

  • Dtypes: int64, uint64, float64
  • Shapes: 1D, 2D, and 3D (where supported)
  • Axes: 0, -1
  • Execution guards: @pytest.mark.skip_if_rank_not_compiled used where multi-dimensional support depends on server configuration

Notable Details

  • Uses NumPy’s stable argsort to ensure deterministic alignment for equal keys.
  • Explicitly preserves NumPy scalar dtypes (e.g., np.uint64) for searchsorted to match Arkouda’s strict dtype checks.
  • Validates not just permutation equality, but that applying argsort permutations 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

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@25cac09). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #5286   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         5           
  Lines           ?       115           
  Branches        ?         0           
========================================
  Hits            ?       115           
  Misses          ?         0           
  Partials        ?         0           
Flag Coverage Δ
python-coverage 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ajpotts ajpotts force-pushed the 5285_alignment_tests_for_arkouda.numpy.sorting branch from 6f21a6b to 3806b18 Compare February 9, 2026 19:14
@ajpotts ajpotts force-pushed the 5285_alignment_tests_for_arkouda.numpy.sorting branch from 3806b18 to 310248d Compare February 9, 2026 19:29
@ajpotts ajpotts marked this pull request as ready for review February 9, 2026 19:29
@ajpotts ajpotts merged commit c651ef4 into Bears-R-Us:main Feb 10, 2026
19 checks passed
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.

alignment tests for arkouda.numpy.sorting

3 participants