Skip to content

Commit f7fc94b

Browse files
committed
Avoid keywords for pos-only args in error messages
1 parent a5f294e commit f7fc94b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

array_api_tests/test_creation_functions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def test_arange(dtype, data):
147147
else:
148148
ph.assert_default_float("arange", out.dtype)
149149
else:
150-
assert out.dtype == dtype
150+
ph.assert_dtype("arange", (out.dtype,), dtype)
151151
assert out.ndim == 1, f"{out.ndim=}, but should be 1 [linspace()]"
152-
f_func = f"[arange({start=}, {stop=}, {step=})]"
152+
f_func = f"[arange({start}, {stop}, {step})]"
153153
# We check size is roughly as expected to avoid edge cases e.g.
154154
#
155155
# >>> xp.arange(2, step=0.333333333333333)
@@ -179,7 +179,7 @@ def test_arange(dtype, data):
179179
if out.size > 0:
180180
assert ah.equal(
181181
out[0], ah.asarray(_start, dtype=out.dtype)
182-
), f"out[0]={out[0]}, but should be {_start} [arange({start=}, {stop=})]"
182+
), f"out[0]={out[0]}, but should be {_start} {f_func}"
183183

184184

185185
@given(hh.shapes(), hh.kwargs(dtype=st.none() | hh.shared_dtypes))
@@ -353,8 +353,12 @@ def test_linspace(num, dtype, endpoint, data):
353353
)
354354
out = xp.linspace(start, stop, num, **kw)
355355

356+
if dtype is None:
357+
ph.assert_default_float("linspace", out.dtype)
358+
else:
359+
ph.assert_dtype("linspace", (out.dtype,), dtype)
356360
ph.assert_shape("linspace", out.shape, num, start=stop, stop=stop, num=num)
357-
f_func = f"[linspace({start=}, {stop=}, {num=})]"
361+
f_func = f"[linspace({start}, {stop}, {num})]"
358362
if num > 0:
359363
assert ah.equal(
360364
out[0], ah.asarray(start, dtype=out.dtype)

0 commit comments

Comments
 (0)