Cleaning up tests and adding variations for numpy/cupy + python list
@@ -119,11 +119,6 @@ class TestIndexing(unittest.TestCase):
self._run(slice(5, 1), 5)
self._run(slice(5, 1, -1), 5)
- def test_major_fancy_minor_fancy(self):
- self._run([1, 5, 4], [1, 5, 4])
- self._run([2, 0, 10], [9, 2, 1])
- self._run([2, 0], [2, 1])
-
def test_major_scalar_minor_slice(self):
self._run(5, slice(1, 5))
self._run(numpy.array(5), slice(1, 5))
@@ -147,6 +142,15 @@ class TestIndexing(unittest.TestCase):
def test_major_all_minor_all(self):
self._run(slice(None), slice(None))
+ def test_ellipsis(self):
+ self._run(Ellipsis, flip_for_csc=False)
+ self._run(Ellipsis, 1, flip_for_csc=False)
+ self._run(1, Ellipsis, flip_for_csc=False)
+ self._run(Ellipsis, slice(None), flip_for_csc=False)
+ self._run(slice(None), Ellipsis, flip_for_csc=False)
+ self._run(Ellipsis, slice(1, None), flip_for_csc=False)
+ self._run(slice(1, None), Ellipsis, flip_for_csc=False)
+
# Major Indexing
def test_major_bool_fancy(self):
@@ -234,14 +238,32 @@ class TestIndexing(unittest.TestCase):
for idx in self._get_index_combos([1, 5, 4, 1, 2]):
self._run(5, idx)
- def test_ellipsis(self):
- self._run(Ellipsis, flip_for_csc=False)
- self._run(Ellipsis, 1, flip_for_csc=False)
- self._run(1, Ellipsis, flip_for_csc=False)
- self._run(Ellipsis, slice(None), flip_for_csc=False)
- self._run(slice(None), Ellipsis, flip_for_csc=False)
- self._run(Ellipsis, slice(1, None), flip_for_csc=False)
- self._run(slice(1, None), Ellipsis, flip_for_csc=False)
+ # Inner Indexing
+
+ def test_major_fancy_minor_fancy(self):
+
+ for idx in self._get_index_combos([1, 5, 4]):
+ self._run(idx, idx)
+
+ self._run([1, 5, 4], [1, 5, 4])
+
+ maj = self._get_index_combos([2, 0, 10])
+ min = self._get_index_combos([9, 2, 1])
+
+ for (idx1, idx2) in zip(maj, min):
+ self._run(idx1, idx2)
+
+ self._run([2, 0, 10, 0], [9, 2, 1, 0])
+
+ maj = self._get_index_combos([2, 0])
+ min = self._get_index_combos([2, 1])
+
+ for (idx1, idx2) in zip(maj, min):
+ self._run(idx1, idx2)
+
+ self._run([2, 0, 2], [2, 1, 2])
+
+ # Bad Indexing
def test_bad_indexing(self):
with pytest.raises(IndexError):
