Closed znicholls closed 5 years ago
:exclamation: No coverage uploaded for pull request base (
master@b224d11
). Click here to learn what that means. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #8 +/- ##
=========================================
Coverage ? 96.35%
=========================================
Files ? 2
Lines ? 137
Branches ? 11
=========================================
Hits ? 132
Misses ? 5
Partials ? 0
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b224d11...5a169dd. Read the comment docs.
Thank you so much for this! I wanted to make sure I properly understood what was going on and had read the stack overflow page before merging which I have now done. This might just be an impression but it looks like a very unpythonic way of doing things. I won't change this now, but is there a more natural structure I can use for tests of this kind? Thanks again R
I won't change this now, but is there a more natural structure I can use for tests of this kind?
pytest's parameterisation is best. However this function returns a list of arrays so I'm not sure you can test it any better unless you want to change the return value...
I finally got around to this.
expected_radii_lists
andresult_radiilist
are lists of lists. However, their elements are all different lengthsThis means that numpy won't cast them to arrays, rather a yuck array of lists.
Hence
np.testing.assert_allclose
doesn't know what to do as it doesn't know how to compare lists, only arrays. The solution is to just loop over the elements inexpected_radii_lists
before passing them tonp.testing.assert_allclose
.To work this out, I took these steps:
np.array(expected_radii_lists)