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
DEP: stats: remove deprecated binom_test #18610
Conversation
result = stats.binomtest(x, n, p=p, alternative=alternative) | ||
return result.pvalue | ||
|
||
def test_data(self): |
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.
Source of reference values unknown. Already well-tested, so remove.
pval = self.binom_test_func([682, 243], p=3/4) | ||
assert_almost_equal(pval, 0.38249155957481695, 11) | ||
|
||
def test_bad_len_x(self): |
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.
See new test_invalid_k_wrong_type
.
def test_bad_n(self): | ||
# len(x) is 1, but n is invalid. | ||
# Missing n | ||
assert_raises(ValueError, self.binom_test_func, [100]) |
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.
Python raises an error when there are too few arguments. No need to test.
# Missing n | ||
assert_raises(ValueError, self.binom_test_func, [100]) | ||
# n less than x[0] | ||
assert_raises(ValueError, self.binom_test_func, [100], n=50) |
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.
See existing test_invalid_k_too_big
.
# n less than x[0] | ||
assert_raises(ValueError, self.binom_test_func, [100], n=50) | ||
|
||
def test_bad_p(self): |
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.
See new test_invalid_p_range
.
assert_raises(ValueError, | ||
self.binom_test_func, [50, 50], p=2.0) | ||
|
||
def test_alternatives(self): |
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.
Source of reference values unknown. Already well-tested, so remove.
assert_almost_equal(res, 0.0437479701823997) | ||
|
||
@pytest.mark.skipif(sys.maxsize <= 2**32, reason="32-bit does not overflow") | ||
def test_boost_overflow_raises(self): |
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.
See new test_boost_overflow_raises
.
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.
Apart from the lint failure which looks related, LGTM
Thanks. I fixed that in the second commit. |
Sorry missed this first time around, there is also a reference to it here scipy/scipy/stats/morestats.py Lines 9 to 25 in 191dd61
|
Reference issue
Closes gh-18581
What does this implement/fix?
This removes the deprecated function
stats.binom_test
.Additional information
See comments about removal of old tests inline.