Clean up unit test for dscim.utils.utils.c_equivalence#135
Merged
kemccusker merged 4 commits intomainfrom Sep 7, 2023
Merged
Conversation
Member
Author
|
We're using |
Codecov Report
@@ Coverage Diff @@
## main #135 +/- ##
=======================================
Coverage 65.30% 65.30%
=======================================
Files 17 17
Lines 1842 1842
=======================================
Hits 1203 1203
Misses 639 639 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
kemccusker
reviewed
Aug 22, 2023
kemccusker
reviewed
Aug 22, 2023
kemccusker
approved these changes
Aug 22, 2023
Member
kemccusker
left a comment
There was a problem hiding this comment.
looks good from my perspective, except for the minor update of the "normal eta" language
JMGilbert
approved these changes
Sep 7, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleans up unit test for
dscim.utils.utils.c_equivalence().dscim.utils.utils.c_equivalence()into multiple tests, with each test checking for a single behavior/test case.expected = (np.divide(array ** (1 - 10), 1 - 10).values.mean() * (1 - 10)) ** (1 / (1 - 10))is now justexpected = xr.DataArray(np.array(2.32634448)), which is the answer I get on my machine.xr.testing.assert_allclose(actual, expected)rather thanassert expected == actual, as the original had done. This is helpful because==checks between floats can be difficult, if not impossible, and unreliable. Usingxr.testing.assert_allcloseallows for some "fuzziness".