diff --git a/tests/test_mathematical.py b/tests/test_mathematical.py index 8b75bcf7fd9..cac1e3385c2 100644 --- a/tests/test_mathematical.py +++ b/tests/test_mathematical.py @@ -1203,9 +1203,6 @@ def test_sum_empty_out(dtype): @pytest.mark.parametrize("transpose", [True, False]) @pytest.mark.parametrize("keepdims", [True, False]) def test_sum(shape, dtype_in, dtype_out, transpose, keepdims): - if transpose and shape in [(1, 2, 3), (3, 3, 3)]: - pytest.skip("muted due to issue dpctl-1391") - size = numpy.prod(shape) a_np = numpy.arange(size).astype(dtype_in).reshape(shape) a = dpnp.asarray(a_np) diff --git a/tests/test_sum.py b/tests/test_sum.py index 8701beafc8a..16b17847f27 100644 --- a/tests/test_sum.py +++ b/tests/test_sum.py @@ -1,12 +1,19 @@ import numpy import pytest +from numpy.testing import ( + assert_array_equal, +) import dpnp -from tests.helper import get_float_dtypes, has_support_aspect64 +from tests.helper import ( + assert_dtype_allclose, + get_float_dtypes, + has_support_aspect64, +) -# Note: numpy.sum() always upcast integers to (u)int64 and float32 to -# float64 for dtype=None. `np.sum` does that too for integers, but not for +# Note: dpnp.sum() always upcast integers to (u)int64 and float32 to +# float64 for dtype=None. `numpy.sum()` does that too for integers, but not for # float32, so we need to special-case it for these tests @pytest.mark.parametrize("dtype", get_float_dtypes()) def test_sum_float(dtype): @@ -22,11 +29,8 @@ def test_sum_float(dtype): for axis in range(len(a)): result = dpnp.sum(ia, axis=axis) - if dtype == dpnp.float32 and has_support_aspect64(): - expected = numpy.sum(a, axis=axis, dtype=numpy.float64) - else: - expected = numpy.sum(a, axis=axis) - numpy.testing.assert_array_equal(expected, result) + expected = numpy.sum(a, axis=axis) + assert_dtype_allclose(result, expected) def test_sum_int(): @@ -35,7 +39,7 @@ def test_sum_int(): result = dpnp.sum(ia) expected = numpy.sum(a) - numpy.testing.assert_array_equal(expected, result) + assert_array_equal(expected, result) def test_sum_axis(): @@ -54,4 +58,4 @@ def test_sum_axis(): expected = numpy.sum(a, axis=1, dtype=numpy.float64) else: expected = numpy.sum(a, axis=1) - numpy.testing.assert_array_equal(expected, result) + assert_array_equal(expected, result) diff --git a/tests/third_party/cupy/math_tests/test_sumprod.py b/tests/third_party/cupy/math_tests/test_sumprod.py index 8f3f2bcc207..9c1d6a0ed2e 100644 --- a/tests/third_party/cupy/math_tests/test_sumprod.py +++ b/tests/third_party/cupy/math_tests/test_sumprod.py @@ -117,7 +117,6 @@ def test_sum_axis2(self, xp, dtype): else: return a.sum(axis=1) - @pytest.mark.skip("muted due to issue dpctl-1391") @testing.for_all_dtypes() @testing.numpy_cupy_allclose(contiguous_check=False) def test_sum_axis_transposed(self, xp, dtype): @@ -128,7 +127,6 @@ def test_sum_axis_transposed(self, xp, dtype): else: return a.sum(axis=1) - @pytest.mark.skip("muted due to issue dpctl-1391") @testing.for_all_dtypes() @testing.numpy_cupy_allclose(contiguous_check=False) def test_sum_axis_transposed2(self, xp, dtype):