Skip to content

Conversation

@ajpotts
Copy link
Contributor

@ajpotts ajpotts commented Jan 7, 2026

Add NumPy alignment tests for dtypes and unary ufuncs

Summary

This PR introduces a new NumPy-alignment verification test suite for Arkouda dtypes and selected unary ufuncs. The goal is to explicitly codify current behavior, surface gaps vs NumPy semantics, and provide a structured place to track alignment progress over time.

What’s Included

  • New test file: tests/numpy/alignment_verification/dtypes_alignment.py
  • Adds coverage for:
    • ak.dtype (string specs, Python scalars, bigint threshold)
    • resolve_scalar_dtype
    • can_cast (including NumPy parity checks)
    • result_type (including bigint vs float precedence)
    • get_byteorder
    • Unary ufunc alignment scaffold (absolute, negative, floor, ceil)
  • Registers the new test file in pytest.ini

Notable Design Decisions

  • Bigint handling: ak.result_type is asserted to return dtype("bigint"), matching NumPy’s result_type contract of returning a dtype, not a Python type.
  • Unary ufunc gaps:
    • ak.floor / ak.ceil are marked as xfail for integer inputs.
    • NumPy supports integer inputs for these ufuncs; Arkouda currently restricts them to floats.
    • A follow-up issue tracks this gap explicitly.

Related Issue

  • Support integer inputs for ak.floor / ak.ceil (NumPy alignment)

Why This Matters

  • Makes Arkouda’s current dtype semantics explicit and testable
  • Prevents silent regressions in dtype promotion and casting logic
  • Provides a clear, incremental path toward tighter NumPy compatibility

Testing

pytest tests/numpy/alignment_verification/dtypes_alignment.py

All existing tests continue to pass; new failures are limited to intentional xfails that document known gaps.

Closes #5252: alignment tests for arkouda.numpy.dtypes

@ajpotts ajpotts force-pushed the 5252_alignment_tests_for_arkouda.numpy.dtypes branch 2 times, most recently from 705624e to 1cbeadd Compare January 8, 2026 00:20
@ajpotts ajpotts force-pushed the 5252_alignment_tests_for_arkouda.numpy.dtypes branch from 1cbeadd to 73679c0 Compare January 8, 2026 22:57
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.dtypes

1 participant