Skip to content

Commit d8fa667

Browse files
committed
Update statistics tests
1 parent d12fad5 commit d8fa667

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

dpnp/tests/third_party/cupy/statistics_tests/test_histogram.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ def test_histogramdd(self, xp, dtype):
497497
weights = xp.ones((x.shape[0],), dtype=self.weights_dtype)
498498
else:
499499
weights = None
500-
501500
y, bin_edges = xp.histogramdd(
502501
x,
503502
bins=bins,
@@ -549,6 +548,13 @@ def test_histogramdd_invalid_range(self):
549548
with pytest.raises(ValueError):
550549
y, bin_edges = xp.histogramdd(x, range=r)
551550

551+
@pytest.mark.skip("list of bins is allowed")
552+
def test_histogramdd_disallow_arraylike_bins(self):
553+
x = testing.shaped_random((16, 2), cupy, scale=100)
554+
bins = [[0, 10, 20, 50, 90]] * 2 # too many dimensions
555+
with pytest.raises(ValueError):
556+
y, bin_edges = cupy.histogramdd(x, bins=bins)
557+
552558

553559
@testing.parameterize(
554560
*testing.product(
@@ -596,9 +602,10 @@ def test_histogram2d(self, xp, dtype):
596602

597603
class TestHistogram2dErrors(unittest.TestCase):
598604

605+
@pytest.mark.skip("list of bins is allowed")
599606
def test_histogram2d_disallow_arraylike_bins(self):
600607
x = testing.shaped_random((16,), cupy, scale=100)
601608
y = testing.shaped_random((16,), cupy, scale=100)
602609
bins = [0, 10, 20, 50, 90]
603610
with pytest.raises(ValueError):
604-
y, bin_edges = cupy.histogram2d(x, y, bins=bins)
611+
y, _, _ = cupy.histogram2d(x, y, bins=bins)

dpnp/tests/third_party/cupy/statistics_tests/test_order.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ def test_quantile_out_of_range_q(self, dtype, method):
252252
with pytest.raises(ValueError):
253253
xp.quantile(a, q, axis=-1, method=method)
254254

255+
@testing.for_all_dtypes(no_float16=True, no_bool=True, no_complex=True)
256+
@testing.numpy_cupy_allclose(rtol=1e-6)
257+
def test_quantile_axis_and_keepdims(self, xp, dtype, method):
258+
a = testing.shaped_random((1, 6, 3, 2), xp, dtype)
259+
q = testing.shaped_random((5,), xp, scale=1)
260+
return xp.quantile(a, q, axis=0, keepdims=True, method=method)
261+
255262

256263
class TestOrder:
257264

0 commit comments

Comments
 (0)