Skip to content

Migrate tests/test_rng.py to NumPy array comparisons - #1219

Merged
seanlaw merged 1 commit into
stumpy-dev:mainfrom
karthiksenv:codex/migrate-rng-comparisons
Nov 14, 2026
Merged

seanlaw merged 1 commit into
stumpy-dev:mainfrom
karthiksenv:codex/migrate-rng-comparisons

Conversation

@karthiksenv

@karthiksenv karthiksenv commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Related to #1175, following Sean's request to complete the remaining comparisons one test file per PR.

tests/test_rng.py replaces its two legacy comparisons with assert_allclose, using atol=1.5e-07, computed values first and named cmp_/ref_ outputs. The expected permutations, RNG call order, scalar checks and state-array equality check are unchanged.

Both existing RNG tests passed on Windows and on Ubuntu with JIT enabled and disabled. Changed-file Black and flake8 passed. Ubuntu development setup, dependency checks, repository-wide formatting/lint, docstring and fastmath checks passed.

Full Ubuntu validation of c978b18 completed all 49 files in each phase: 2,363 passed and 32 skipped with JIT enabled, then 2,510 passed and 17 skipped in the coverage phase. Running the existing two RNG tests with the fixed seed unset filled the default initialization line's coverage gap; the final report passed at 100% across 15,109 statements. All 216 archived source files and executable bits matched the commit after testing. Ray and pyFFTW were unavailable; CUDA used the simulator, with no physical GPU testing.

The hosted Tests workflow passed on c978b18: all 31 jobs succeeded across the generated Python/platform matrix.

OpenAI Codex assisted with the migration, validation and PR text.

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Read our Contributing Guide
  • Referenced a Github issue (or create one if one doesn't already exist)
  • Read and reviewed all of the comments in the Github issue that you've referenced (along with cross-referenced issues/pull requests) to ensure that the issue still requires a pull request
  • Checked that the issue has not already been assigned to anybody else or is already being addressed in another pull request
  • Left a meaningful comment on the original Github issue to discuss the detailed approach for your contribution and received confirmation from the maintainers before proceeding with this pull request
  • Forked, cloned, and checked out the newest version of the code
  • Created a new branch
  • Made necessary code changes
  • Installed black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Installed flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Installed pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Ran black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./ in the root stumpy directory
  • Ran flake8 --extend-exclude=.venv ./ in the root stumpy directory
  • Ran ./setup.sh dev && ./test.sh in the root stumpy directory and ensured that all tests are passing locally
  • Check this box if AI code assistance was used to generate
    • less than 25% of the code in this pull request
    • 25-50% of the code in this pull request
    • more than 50% of the code in this pull request

Please do not commit any code to avoid/circumvent a failing test and, instead, engage in a discussion (below) to determine the best course of action.

Only request a review after the checklist above is fully completed!

@gitnotebooks

gitnotebooks Bot commented Nov 13, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1219

@karthiksenv
karthiksenv marked this pull request as ready for review November 13, 2026 23:12
@karthiksenv
karthiksenv requested a review from seanlaw as a code owner November 13, 2026 23:12
@seanlaw
seanlaw merged commit df30b04 into stumpy-dev:main Nov 14, 2026
33 checks passed
@seanlaw

seanlaw commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@karthiksenv Thank you for this PR!

@karthiksenv

Copy link
Copy Markdown
Contributor Author

Thanks for merging the RNG test update, Sean. I'm glad I got to help with this part of the migration.

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.

2 participants