Skip to content

Commit

Permalink
Update test_sum_float in test_sum.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-perevezentsev committed Dec 4, 2023
1 parent 42b199d commit e0b6f0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ def test_sum_float(dtype):
)
ia = dpnp.array(a)

# Flag for type check in special cases
# Skip dtype checks when dpnp handles float32 arrays
# as `dpnp.sum()` and `numpy.sum()` return different dtypes
check_dtype = dtype != dpnp.float32
for axis in range(len(a)):
result = dpnp.sum(ia, axis=axis)
expected = numpy.sum(a, axis=axis)
assert_dtype_allclose(result, expected)
assert_dtype_allclose(result, expected, check_type=check_dtype)
if not check_dtype:
# Ensure dtype kind matches when check_dtype is False
assert result.dtype.kind == expected.dtype.kind


def test_sum_int():
Expand Down

0 comments on commit e0b6f0e

Please sign in to comment.