Skip to content

Commit afc7822

Browse files
committed
Use math.isnan for checking fill_value
1 parent 4aa49d4 commit afc7822

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

array_api_tests/test_creation_functions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import math
2+
13
from ._array_module import (asarray, arange, ceil, empty, empty_like, eye, full,
24
full_like, equal, all, linspace, ones, ones_like,
35
zeros, zeros_like, isnan)
@@ -157,7 +159,7 @@ def test_full(shape, fill_value, kw):
157159
else:
158160
assert out.dtype == dtype
159161
assert out.shape == shape, f"{shape=}, but full() returned an array with shape {out.shape}"
160-
if is_float_dtype(out.dtype) and isnan(asarray(fill_value)):
162+
if is_float_dtype(out.dtype) and math.isnan(fill_value):
161163
assert all(isnan(out)), "full() array did not equal the fill value"
162164
else:
163165
assert all(equal(out, asarray(fill_value, dtype=dtype))), "full() array did not equal the fill value"
@@ -183,7 +185,7 @@ def test_full_like(x, fill_value, kw):
183185
else:
184186
assert out.dtype == dtype, f"{dtype=!s}, but full_like() returned an array with dtype {out.dtype}"
185187
assert out.shape == x.shape, "{x.shape=}, but full_like() returned an array with shape {out.shape}"
186-
if is_float_dtype(dtype) and isnan(asarray(fill_value)):
188+
if is_float_dtype(dtype) and math.isnan(fill_value):
187189
assert all(isnan(out)), "full_like() array did not equal the fill value"
188190
else:
189191
assert all(equal(out, asarray(fill_value, dtype=dtype))), "full_like() array did not equal the fill value"

0 commit comments

Comments
 (0)