Skip to content

Conversation

@ajpotts
Copy link
Contributor

@ajpotts ajpotts commented Jan 8, 2026

Add NumPy Alignment Tests for pdarray (with Explicit XFAILs)

Summary

This PR introduces a comprehensive NumPy alignment verification suite for pdarray and wires it into pytest execution.
The new tests systematically compare Arkouda behavior against NumPy across binary ops, unary ops, indexing, reshaping,
and basic array contract semantics.

Where Arkouda intentionally diverges from NumPy today, the tests use explicit, well-documented xfails
so that:

  • CI remains green
  • Known semantic gaps are visible and actionable
  • Removing an xfail is the signal that a semantic fix has landed

Key Changes

New tests

  • tests/numpy/alignment_verification/pdarrayclass_alignment.py
    • Binary operators (+ - * / // % ** & | ^ << >>)
    • Unary operators (+ - ~)
    • Comparisons
    • Slicing and boolean masking
    • Reshape / flatten / take
    • Core array contract checks (len, truthiness, equals)
    • NumPy-as-oracle behavior: if NumPy raises, Arkouda is expected to raise

Explicit NumPy-alignment XFAILs

Documented mismatches where Arkouda semantics differ from NumPy:

  • Signed integer //: truncation vs NumPy floor-division
  • Signed integer %: remainder semantics tied to floor-division
  • Signed integer >>: logical vs NumPy arithmetic right shift
  • bool ** bool dtype: unsigned vs NumPy signed integer promotion

Each xfail includes a clear reason string to support future cleanup.

Test configuration updates

  • Add new alignment test file to pytest.ini

Why This Matters

  • Establishes a systematic contract between Arkouda and NumPy
  • Prevents silent semantic drift
  • Provides a roadmap for closing correctness gaps incrementally
  • Makes future NumPy upgrades easier to reason about

Close #5258 alignment tests for arkouda.numpy.pdarrayclass

@ajpotts ajpotts force-pushed the 5258_alignment_tests_for_arkouda.numpy.pdarrayclass branch 3 times, most recently from 631e507 to 9188cd3 Compare January 9, 2026 00:30
@ajpotts ajpotts force-pushed the 5258_alignment_tests_for_arkouda.numpy.pdarrayclass branch from 9188cd3 to 2dc5c33 Compare January 9, 2026 13:06
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.pdarrayclass

1 participant