Skip to content

Commit 3f7410f

Browse files
committed
Extend third_party/cupy/statistics_tests/test_order.py with testing of new methods
1 parent d31c2de commit 3f7410f

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1+
from __future__ import annotations
2+
13
import warnings
24

35
import numpy
46
import pytest
57

68
import dpnp as cupy
9+
10+
# import cupy._core._accelerator as _acc
11+
# from cupy import cuda
712
from dpnp.tests.third_party.cupy import testing
813

914
_all_methods = (
1015
# 'inverted_cdf', # TODO(takagi) Not implemented
1116
# 'averaged_inverted_cdf', # TODO(takagi) Not implemented
1217
# 'closest_observation', # TODO(takagi) Not implemented
1318
# 'interpolated_inverted_cdf', # TODO(takagi) Not implemented
14-
# 'hazen', # TODO(takagi) Not implemented
15-
# 'weibull', # TODO(takagi) Not implemented
19+
"hazen",
20+
"weibull",
1621
"linear",
17-
# 'median_unbiased', # TODO(takagi) Not implemented
18-
# 'normal_unbiased', # TODO(takagi) Not implemented
22+
"median_unbiased",
23+
"normal_unbiased",
1924
"lower",
2025
"higher",
2126
"midpoint",
@@ -166,9 +171,8 @@ def test_percentile_out_of_range_q(self, dtype, method):
166171
with pytest.raises(ValueError):
167172
xp.percentile(a, q, axis=-1, method=method)
168173

169-
@testing.for_all_dtypes()
170174
@testing.for_all_dtypes(no_float16=True, no_bool=True, no_complex=True)
171-
@testing.numpy_cupy_allclose()
175+
@testing.numpy_cupy_allclose(rtol=1e-6)
172176
def test_quantile_defaults(self, xp, dtype, method):
173177
a = testing.shaped_random((2, 3, 8), xp, dtype)
174178
q = testing.shaped_random((3,), xp, scale=1)
@@ -391,12 +395,16 @@ def test_ptp_axis2(self, xp, dtype):
391395
@testing.for_float_dtypes()
392396
@testing.numpy_cupy_allclose()
393397
def test_ptp_nan(self, xp, dtype):
398+
# if _acc.ACCELERATOR_CUTENSOR in _acc.get_routine_accelerators():
399+
# pytest.skip()
394400
a = xp.array([float("nan"), 1, -1], dtype)
395401
return xp.ptp(a)
396402

397403
@testing.for_float_dtypes()
398404
@testing.numpy_cupy_allclose()
399405
def test_ptp_all_nan(self, xp, dtype):
406+
# if _acc.ACCELERATOR_CUTENSOR in _acc.get_routine_accelerators():
407+
# pytest.skip()
400408
a = xp.array([float("nan"), float("nan")], dtype)
401409
return xp.ptp(a)
402410

0 commit comments

Comments
 (0)