Skip to content

Commit 52e835e

Browse files
committed
Support None in sh.fmt_i()
1 parent 373dd48 commit 52e835e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

array_api_tests/meta/test_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ def test_roll_ndindex(shape, shifts, axes, expected):
9191
((), "x"),
9292
(42, "x[42]"),
9393
((42,), "x[42]"),
94+
((42, 7), "x[42, 7]"),
9495
(slice(None, 2), "x[:2]"),
9596
(slice(2, None), "x[2:]"),
9697
(slice(0, 2), "x[0:2]"),
9798
(slice(0, 2, -1), "x[0:2:-1]"),
9899
(slice(None, None, -1), "x[::-1]"),
99100
(slice(None, None), "x[:]"),
100101
(..., "x[...]"),
102+
((None, 42), "x[None, 42]"),
101103
],
102104
)
103105
def test_fmt_idx(idx, expected):

array_api_tests/shape_helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ def fmt_i(i: AtomicIndex) -> str:
156156
if i.step is not None:
157157
res += f":{i.step}"
158158
return res
159+
elif i is None:
160+
return "None"
159161
else:
160162
return "..."
161163

0 commit comments

Comments
 (0)