Skip to content

Commit 459f634

Browse files
Update test_sum
1 parent 71ec88e commit 459f634

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

tests/test_sum.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
import dpnp
2+
from .helper import skip_or_check_if_dtype_not_supported
23

34
import numpy
45

56

6-
def test_sum_float64():
7-
a = numpy.array([[[-2., 3.], [9.1, 0.2]], [[-2., 5.0], [-2, -1.2]], [[1.0, -2.], [5.0, -1.1]]])
7+
dtype = numpy.float64 if skip_or_check_if_dtype_not_supported(
8+
numpy.float64, check_dtype=True
9+
) else numpy.float32
10+
11+
12+
def test_sum_float():
13+
a = numpy.array(
14+
[
15+
[[-2.0, 3.0], [9.1, 0.2]],
16+
[[-2.0, 5.0], [-2, -1.2]],
17+
[[1.0, -2.0], [5.0, -1.1]],
18+
],
19+
dtype=dtype,
20+
)
821
ia = dpnp.array(a)
922

1023
for axis in range(len(a)):
@@ -23,7 +36,14 @@ def test_sum_int():
2336

2437

2538
def test_sum_axis():
26-
a = numpy.array([[[-2., 3.], [9.1, 0.2]], [[-2., 5.0], [-2, -1.2]], [[1.0, -2.], [5.0, -1.1]]])
39+
a = numpy.array(
40+
[
41+
[[-2.0, 3.0], [9.1, 0.2]],
42+
[[-2.0, 5.0], [-2, -1.2]],
43+
[[1.0, -2.0], [5.0, -1.1]],
44+
],
45+
dtype=dtype,
46+
)
2747
ia = dpnp.array(a)
2848

2949
result = dpnp.sum(ia, axis=1)

0 commit comments

Comments
 (0)