Skip to content

Commit d5ea2ef

Browse files
committed
Correctly handle fill_value=nan in test_full()
1 parent 1cf1747 commit d5ea2ef

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

array_api_tests/test_creation_functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from ._array_module import (arange, ceil, empty, _floating_dtypes, eye, full,
2-
equal, all, linspace, ones, zeros)
2+
equal, all, linspace, ones, zeros, isnan)
33
from .array_helpers import (is_integer_dtype, dtype_ranges,
44
assert_exactly_equal, isintegral)
55
from .hypothesis_helpers import (numeric_dtypes, dtypes, MAX_ARRAY_SIZE,
@@ -116,7 +116,10 @@ def test_full(shape, fill_value, dtype):
116116
assert a.dtype == dtype
117117

118118
assert a.shape == shape, "full() produced an array with incorrect shape"
119-
assert all(equal(a, fill_value)), "full() array did not equal the fill value"
119+
if isnan(fill_value):
120+
assert all(isnan(a)), "full() array did not equal the fill value"
121+
else:
122+
assert all(equal(a, fill_value)), "full() array did not equal the fill value"
120123

121124
# TODO: implement full_like (requires hypothesis arrays support)
122125
def test_full_like():

0 commit comments

Comments
 (0)