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
@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     #5260   +/-   ##
========================================
  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.pdarrayclass

2 participants