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

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@168089e). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 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.

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

2 participants