Skip to content

Commit 528dda4

Browse files
committed
Fix some checks in test_linspace
If dtype=None then full() may default to an integer dtype if start/stop are integers, but linspace should always default to float.
1 parent 0445601 commit 528dda4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

array_api_tests/test_creation_functions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_linspace(start, stop, num, dtype, endpoint):
160160

161161
if endpoint in [None, True]:
162162
if num > 1:
163-
assert all(equal(a[-1], full((), stop, dtype=dtype))), "linspace() produced an array that does not include the endpoint"
163+
assert all(equal(a[-1], full((), stop, dtype=a.dtype))), "linspace() produced an array that does not include the endpoint"
164164
else:
165165
# linspace(..., num, endpoint=False) is the same as the first num
166166
# elements of linspace(..., num+1, endpoint=True)
@@ -169,7 +169,7 @@ def test_linspace(start, stop, num, dtype, endpoint):
169169

170170
if num > 0:
171171
# We need to cast start to dtype
172-
assert all(equal(a[0], full((), start, dtype=dtype))), "linspace() produced an array that does not start with the start"
172+
assert all(equal(a[0], full((), start, dtype=a.dtype))), "linspace() produced an array that does not start with the start"
173173

174174
# TODO: This requires an assert_approx_equal function
175175

0 commit comments

Comments
 (0)