Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bjodah
Copy link
Contributor

@bjodah bjodah commented Sep 15, 2024

Noticed that these were missing.

def test_maximum(self):
arr1 = (998, 999) * pq.m
arr2 = (1e3, 5e2) * pq.m
self.assertQuantityEqual(np.maximum(arr1, arr2) - [1000, 999]*pq.m, [0, 0]*pq.m)
Copy link
Contributor

@zm711 zm711 Sep 30, 2024

Choose a reason for hiding this comment

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

Out of curiosity why do the subtraction and then compare to 0 rather than compare directly to the values? Is there a benefit to doing this in readability or reliability? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a habit of mine, no particular reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. Just wanted to make sure I wasn't missing a trick. Thanks!

@apdavison apdavison merged commit e5c63fd into python-quantities:master Oct 16, 2024
39 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