Skip to content

Comments

tests for numpy reshape (+bugfixes)#112

Merged
tennlee merged 14 commits intoACCESS-Community-Hub:developfrom
gemmaellen:issue_97_reshape_tests
May 22, 2025
Merged

tests for numpy reshape (+bugfixes)#112
tennlee merged 14 commits intoACCESS-Community-Hub:developfrom
gemmaellen:issue_97_reshape_tests

Conversation

@gemmaellen
Copy link
Collaborator

Hey! I've written tests for numpy/reshape.py. Most of them are straightforward, but there are a couple of things that are worth reviewing. Specifically, in numpy/reshape.py, I want to note that:

  • I've commented out lines 225-226. I don't think the "while" condition is realistically likely to happen, and if it did, then the listed response is totally unhelpful. data[-len(shape)] isn't usually an integer anyway. It's possible that it should be data.shape[-len(shape)] but even then I'm not sure why you'd want it.
  • Line 233 is the old version of line 234. It was getting in the way of the "trivial" undo -- namely, when you undo a reshape that hasn't actually changed the shape. I don't know why it used to be in the form it was in, but this version seems to do the trick nicely.

I'd appreciate a check that my fixes haven't accidentally broken something, but I think this is probably closer to what we want the code to be.

@gemmaellen gemmaellen requested a review from tennlee May 21, 2025 03:28
@coveralls
Copy link

coveralls commented May 21, 2025

Pull Request Test Coverage Report for Build 15183996552

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 115 of 115 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.9%) to 60.862%

Totals Coverage Status
Change from base Build 15139881597: 0.9%
Covered Lines: 9874
Relevant Lines: 15767

💛 - Coveralls

@tennlee
Copy link
Collaborator

tennlee commented May 22, 2025

Thanks. I applied the black formatter to fix the pre-commit check.

I agree with your changes but will leave the commented-out lines in the file for now in case they prove helpful. To my eyes they look "overly helpful" and are handling some shape mismatch condition that may have been encountered but is not covered by our tests or current notebooks / examples in manual testing. I will re-run the notebooks at some point after this and confirm nothing breaks there. If needed, the commented-out lines are easily restored.

Thank you very much for putting in good tests to cover this important area of functionality!

@tennlee tennlee merged commit f87a5a3 into ACCESS-Community-Hub:develop May 22, 2025
7 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.

3 participants