Skip to content

Commit

Permalink
Pass stop and step as pos args in test_arange
Browse files Browse the repository at this point in the history
  • Loading branch information
honno committed Oct 29, 2021
1 parent f7fc94b commit 794ef30
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions array_api_tests/test_creation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,8 @@ def test_arange(dtype, data):
size <= hh.MAX_ARRAY_SIZE
), f"{size=} should be no more than {hh.MAX_ARRAY_SIZE}" # sanity check

kw = data.draw(
hh.specified_kwargs(
hh.KVD("stop", stop, None),
hh.KVD("step", step, None),
hh.KVD("dtype", dtype, None),
),
label="kw",
)
out = xp.arange(start, **kw)
kw = data.draw(hh.specified_kwargs(hh.KVD("dtype", dtype, None)), label="kw")
out = xp.arange(start, stop, step, **kw)

if dtype is None:
if all_int:
Expand All @@ -149,7 +142,10 @@ def test_arange(dtype, data):
else:
ph.assert_dtype("arange", (out.dtype,), dtype)
assert out.ndim == 1, f"{out.ndim=}, but should be 1 [linspace()]"
f_func = f"[arange({start}, {stop}, {step})]"
if stop is None:
f_func = f"[arange({start}, {step=})]"
else:
f_func = f"[arange({start}, {stop}, {step})]"
# We check size is roughly as expected to avoid edge cases e.g.
#
# >>> xp.arange(2, step=0.333333333333333)
Expand Down

0 comments on commit 794ef30

Please sign in to comment.