New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kendalltau function now returns a nan tuple if empty arrays used as para... #3885
Conversation
…arameters instead of raising a runtime exception
A regression test would be good. |
Should I do something? Or is that what Travis CI is for? |
TravisCI will run the tests to try catching regressions, but I was thinking that adding a new test would be appropriate. For example, a test could be added that would have caused a RuntimeError but no longer raises the exception after your change. |
Ah, that makes sense. |
Changes Unknown when pulling 54704c2 on ctokheim:master into * on scipy:master*. |
Changes Unknown when pulling 061a5a8 on ctokheim:master into * on scipy:master*. |
@@ -633,6 +633,9 @@ def test_kendalltau(): | |||
assert_(np.all(np.isnan(stats.kendalltau([2,0,2], [2,2,2])))) | |||
assert_(np.all(np.isnan(stats.kendalltau([2,2,2], [2,0,2])))) | |||
|
|||
# empty arrays provided as input | |||
assert_(np.all(np.isnan(stats.kendalltau([], [])))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_equal
has code to handle nan
, so this can be simplified to assert_equal(stats.kendalltau([], []), (np.nan, np.nan))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I changed the checking for both the tie case and empty array case to use assert_equal
.
kendalltau function now returns a nan tuple if empty arrays used as para...
Looks good, merging. Thanks @ctokheim. |
...meters instead of raising a runtime exception. Previously, empty arrays would have cause a maximum recursion depth exceeded error in mergesort if the provided arrays were empty (issue #3884).