Skip to content

Commit

Permalink
Merge pull request #20663 from mdhaber/gh20661
Browse files Browse the repository at this point in the history
MAINT: stats.kruskal: fix no-arg behavior w/ SCIPY_ARRAY_API=1
  • Loading branch information
tylerjereddy committed May 8, 2024
2 parents eb6156b + 8fde6e2 commit 17a3aa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scipy/stats/_axis_nan_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def _broadcast_arrays(arrays, axis=None, xp=None):
"""
Broadcast shapes of arrays, ignoring incompatibility of specified axes
"""
if not arrays:
return arrays
xp = array_namespace(*arrays) if xp is None else xp
arrays = [xp.asarray(arr) for arr in arrays]
shapes = [arr.shape for arr in arrays]
Expand Down
5 changes: 5 additions & 0 deletions scipy/stats/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -7679,6 +7679,11 @@ def test_large_no_samples(self):
expected = 0
assert_approx_equal(p, expected)

def test_no_args_gh20661(self):
message = r"Need at least two groups in stats.kruskal\(\)"
with pytest.raises(ValueError, match=message):
stats.kruskal()


class TestCombinePvalues:

Expand Down

0 comments on commit 17a3aa0

Please sign in to comment.