Skip to content

Commit 239cca7

Browse files
authored
Unmuted tests for dpnp.sum (#1552)
1 parent 80eb738 commit 239cca7

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

tests/test_mathematical.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,9 +1203,6 @@ def test_sum_empty_out(dtype):
12031203
@pytest.mark.parametrize("transpose", [True, False])
12041204
@pytest.mark.parametrize("keepdims", [True, False])
12051205
def test_sum(shape, dtype_in, dtype_out, transpose, keepdims):
1206-
if transpose and shape in [(1, 2, 3), (3, 3, 3)]:
1207-
pytest.skip("muted due to issue dpctl-1391")
1208-
12091206
size = numpy.prod(shape)
12101207
a_np = numpy.arange(size).astype(dtype_in).reshape(shape)
12111208
a = dpnp.asarray(a_np)

tests/test_sum.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import numpy
22
import pytest
3+
from numpy.testing import (
4+
assert_array_equal,
5+
)
36

47
import dpnp
5-
from tests.helper import get_float_dtypes, has_support_aspect64
8+
from tests.helper import (
9+
assert_dtype_allclose,
10+
get_float_dtypes,
11+
has_support_aspect64,
12+
)
613

714

8-
# Note: numpy.sum() always upcast integers to (u)int64 and float32 to
9-
# float64 for dtype=None. `np.sum` does that too for integers, but not for
15+
# Note: dpnp.sum() always upcast integers to (u)int64 and float32 to
16+
# float64 for dtype=None. `numpy.sum()` does that too for integers, but not for
1017
# float32, so we need to special-case it for these tests
1118
@pytest.mark.parametrize("dtype", get_float_dtypes())
1219
def test_sum_float(dtype):
@@ -22,11 +29,8 @@ def test_sum_float(dtype):
2229

2330
for axis in range(len(a)):
2431
result = dpnp.sum(ia, axis=axis)
25-
if dtype == dpnp.float32 and has_support_aspect64():
26-
expected = numpy.sum(a, axis=axis, dtype=numpy.float64)
27-
else:
28-
expected = numpy.sum(a, axis=axis)
29-
numpy.testing.assert_array_equal(expected, result)
32+
expected = numpy.sum(a, axis=axis)
33+
assert_dtype_allclose(result, expected)
3034

3135

3236
def test_sum_int():
@@ -35,7 +39,7 @@ def test_sum_int():
3539

3640
result = dpnp.sum(ia)
3741
expected = numpy.sum(a)
38-
numpy.testing.assert_array_equal(expected, result)
42+
assert_array_equal(expected, result)
3943

4044

4145
def test_sum_axis():
@@ -54,4 +58,4 @@ def test_sum_axis():
5458
expected = numpy.sum(a, axis=1, dtype=numpy.float64)
5559
else:
5660
expected = numpy.sum(a, axis=1)
57-
numpy.testing.assert_array_equal(expected, result)
61+
assert_array_equal(expected, result)

tests/third_party/cupy/math_tests/test_sumprod.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ def test_sum_axis2(self, xp, dtype):
117117
else:
118118
return a.sum(axis=1)
119119

120-
@pytest.mark.skip("muted due to issue dpctl-1391")
121120
@testing.for_all_dtypes()
122121
@testing.numpy_cupy_allclose(contiguous_check=False)
123122
def test_sum_axis_transposed(self, xp, dtype):
@@ -128,7 +127,6 @@ def test_sum_axis_transposed(self, xp, dtype):
128127
else:
129128
return a.sum(axis=1)
130129

131-
@pytest.mark.skip("muted due to issue dpctl-1391")
132130
@testing.for_all_dtypes()
133131
@testing.numpy_cupy_allclose(contiguous_check=False)
134132
def test_sum_axis_transposed2(self, xp, dtype):

0 commit comments

Comments
 (0)