Skip to content

Commit b2f3a77

Browse files
committed
Add some comments to the indexing tests
1 parent 14f1193 commit b2f3a77

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

array_api_tests/test_indexing.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
@given(shared(sizes, key='array_sizes'), integer_indices(shared(sizes, key='array_sizes')))
2020
def test_integer_indexing(size, idx):
2121
# Test that indices on single dimensional arrays give the same result as
22-
# Python lists. idx may be a Python integer or a 0-D array with integer dtype.
22+
# Python lists. idx may be a Python integer or a 0-D array with integer
23+
# dtype.
2324

2425
# Sanity check that the strategies are working properly
2526
assert -size <= int(idx) <= max(0, size - 1), "Sanity check failed. This indicates a bug in the test suite"
2627

28+
# The spec only requires support for a single integer index on dimension 1
29+
# arrays.
2730
a = arange(size)
2831
l = list(range(size))
2932
# TODO: We can remove int() here if we add __index__ to the spec. See
@@ -47,6 +50,9 @@ def test_slicing(size, s):
4750
assert -size <= s.stop <= size, "Sanity check failed. This indicates a bug in the test suite"
4851
else:
4952
assert -size - 1 <= s.stop <= size - 1, "Sanity check failed. This indicates a bug in the test suite"
53+
54+
# The spec only requires support for a single slice index on dimension 1
55+
# arrays.
5056
a = arange(size)
5157
l = list(range(size))
5258
sliced_list = l[s]

0 commit comments

Comments
 (0)