Skip to content

Closes #5294: alignment tests for arkouda.numpy.random.legacy#5296

Merged
ajpotts merged 3 commits intoBears-R-Us:mainfrom
ajpotts:5294_alignment_tests_for_arkouda.numpy.random.legacy
Feb 12, 2026
Merged

Closes #5294: alignment tests for arkouda.numpy.random.legacy#5296
ajpotts merged 3 commits intoBears-R-Us:mainfrom
ajpotts:5294_alignment_tests_for_arkouda.numpy.random.legacy

Conversation

@ajpotts
Copy link
Contributor

@ajpotts ajpotts commented Jan 10, 2026

Add NumPy-alignment tests for legacy random API (bool randint discrepancy tracked)

Summary

This PR adds a NumPy-alignment test suite covering Arkouda’s legacy random API, with an emphasis on:

  • shape semantics
  • value bounds
  • dtype behavior
  • error-message alignment with NumPy’s legacy RandomState

A known discrepancy in randint(dtype=bool) error messages is intentionally captured and marked as xfail, so the suite documents the divergence without breaking CI.

What’s included

  • New test module:
    • tests/numpy/alignment_verification/random_legacy_alignment.py
  • Added to pytest.ini test discovery
  • Coverage for:
    • ak.random.rand (scalar and multi-dimensional shapes)
    • ak.random.randint (int64 bounds and shape semantics)
    • ak.random.uniform
    • ak.random.standard_normal (distribution sanity checks)
    • ak.random.random

NumPy alignment strategy

For randint(dtype=bool), expected error messages are derived dynamically from:

numpy.random.RandomState.randint(..., dtype=bool)

This avoids hard-coding fragile strings and ensures the tests track NumPy’s actual behavior.

Known discrepancy (xfail)

For randint(dtype=bool) with negative low:

  • NumPy raises:
    ValueError: low is out of bounds for bool
    
  • Arkouda currently raises:
    ValueError: low < 0
    

This mismatch is explicitly detected and marked with:

pytest.xfail(... Issue #5295)

so CI remains green while preserving a clear signal that behavior differs from NumPy.

Why this matters

  • Establishes a reusable pattern for NumPy-alignment testing
  • Makes random API differences explicit and actionable
  • Prevents silent divergence in user-facing behavior

Follow-up

Once Arkouda’s randint(dtype=bool) validation is updated to match NumPy’s error message, the xfail can be removed and the test will pass automatically.

Closes #5294: alignment tests for arkouda.numpy.random.legacy
Closes #5318: Legacy RNG global generator becomes stale across server restart, causing UnknownSymbolError in seed()

@ajpotts ajpotts changed the title Closes 5294: alignment tests for arkouda.numpy.random.legacy Closes #5294: alignment tests for arkouda.numpy.random.legacy Jan 10, 2026
@ajpotts ajpotts force-pushed the 5294_alignment_tests_for_arkouda.numpy.random.legacy branch 2 times, most recently from 1e7f3b4 to 978d7e4 Compare January 16, 2026 16:49
@ajpotts ajpotts force-pushed the 5294_alignment_tests_for_arkouda.numpy.random.legacy branch from 66eaf02 to 1281476 Compare February 9, 2026 21:00
@ajpotts ajpotts force-pushed the 5294_alignment_tests_for_arkouda.numpy.random.legacy branch from 1281476 to 45017e2 Compare February 9, 2026 22:46
@ajpotts ajpotts marked this pull request as ready for review February 9, 2026 23:04
Copy link
Contributor

@1RyanK 1RyanK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

@jaketrookman jaketrookman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ajpotts ajpotts merged commit 0c85177 into Bears-R-Us:main Feb 12, 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.

Legacy RNG global generator becomes stale across server restart, causing UnknownSymbolError in seed() alignment tests for arkouda.numpy.random.legacy

3 participants