Skip to content

gh-1076: Use array comparison functions from array-api-extra - #1083

Merged
paddyroddy merged 59 commits into
mainfrom
paddy/issue-1076
Jun 4, 2026
Merged

gh-1076: Use array comparison functions from array-api-extra#1083
paddyroddy merged 59 commits into
mainfrom
paddy/issue-1076

Conversation

@paddyroddy

@paddyroddy paddyroddy commented May 19, 2026

Copy link
Copy Markdown
Member

Description

As can be seen in scipy/scipy#25143 and scikit-learn/scikit-learn#34019, array-api-extra now provides array comparison methods. This means we should be able to remove our custom Compare helper class.

Closes: #1076

Changelog entry

Changed: Used array_api_extra.testing for array comparison in tests

Checks

  • Is your code passing linting?
  • Is your code passing tests?
  • Have you added additional tests (if required)?
  • Have you modified/extended the documentation (if required)?
  • Have you added a one-liner changelog entry above (if required)?

@paddyroddy paddyroddy self-assigned this May 19, 2026
@paddyroddy paddyroddy added enhancement New feature or request dependencies Pull requests that update a dependency file array-api Work is related to the Array API testing Work is related to testing labels May 19, 2026
@paddyroddy
paddyroddy marked this pull request as ready for review May 21, 2026 14:21
@paddyroddy
paddyroddy marked this pull request as draft May 21, 2026 14:53
@paddyroddy

Copy link
Copy Markdown
Member Author

Failing tests

I know, that's because array-api-extra hasn't done a release. Can you review anyway?

@connoraird connoraird left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I stopped writing the same comment after a while but I think double checking the types of what we are comparing and making sure it should be assert_close or assert_equal would be good.

Comment thread tests/benchmarks/test_arraytools.py Outdated
Comment thread tests/benchmarks/test_lensing.py
Comment thread tests/core/grf/test_transformations.py
Comment thread tests/core/test_fields.py
Comment thread tests/core/test_galaxies.py
Comment thread tests/core/test_healpix.py
Comment thread tests/core/test_healpix.py
Comment thread tests/core/test_points.py
@paddyroddy

Copy link
Copy Markdown
Member Author

I've done a find-and-replace and then iterated to include more assert_equal calls. But I don't agree that because something is float that we should necessarily use assert_close. If you consider the NumPy implementation it's to do with equality up to a tolerance. If that tolerance is 0, then they may as well be equal.

@paddyroddy
paddyroddy requested a review from connoraird June 3, 2026 11:03
@paddyroddy

Copy link
Copy Markdown
Member Author

Have merged in #1089

@lucascolley

Copy link
Copy Markdown

exams done, please do give https://github.com/data-apis/array-api-extra/releases/tag/v0.10.2 a test!

@lucascolley

Copy link
Copy Markdown

oops, made it to PyPI this time https://pypi.org/project/array-api-extra/

@paddyroddy
paddyroddy requested a review from Copilot June 3, 2026 14:58
@paddyroddy paddyroddy removed the blocked The issue or pull request is blocked by something label Jun 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Comment thread pyproject.toml
Comment thread tests/core/test_points.py
@paddyroddy paddyroddy mentioned this pull request Jun 3, 2026
5 tasks
Copilot stopped work on behalf of paddyroddy due to an error June 3, 2026 15:36
@paddyroddy

Copy link
Copy Markdown
Member Author

Merging now. Hope the exams went well @lucascolley!

@paddyroddy
paddyroddy merged commit 0c9768c into main Jun 4, 2026
18 of 21 checks passed
@paddyroddy
paddyroddy deleted the paddy/issue-1076 branch June 4, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

array-api Work is related to the Array API dependencies Pull requests that update a dependency file enhancement New feature or request testing Work is related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backend-agnostic Compare

5 participants