Skip to content

Commit 9714cf3

Browse files
authored
Enable the whole scope of indexing tests in public CI (#2049)
1 parent 6314346 commit 9714cf3

File tree

4 files changed

+17
-44
lines changed

4 files changed

+17
-44
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ env:
5353
third_party/cupy/core_tests
5454
third_party/cupy/fft_tests
5555
third_party/cupy/creation_tests
56-
third_party/cupy/indexing_tests/test_indexing.py
57-
third_party/cupy/indexing_tests/test_generate.py
56+
third_party/cupy/indexing_tests
5857
third_party/cupy/lib_tests
5958
third_party/cupy/linalg_tests
6059
third_party/cupy/logic_tests

tests/skipped_tests.tbl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,6 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_pa
5555
tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_max
5656
tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_min
5757

58-
tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_AxisConcatenator_init1
59-
tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_len
60-
tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_1
61-
tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_2
62-
tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_3
63-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_1
64-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_2
65-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_3
66-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_4
67-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_5
68-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_6
69-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_7
70-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_8
71-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_9
72-
7358
tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmaskDifferentDtypes::test_putmask_differnt_dtypes_raises
7459
tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmask::test_putmask_non_equal_shape_raises
7560

tests/skipped_tests_gpu.tbl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,6 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_pa
108108
tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_max
109109
tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_min
110110

111-
tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_AxisConcatenator_init1
112-
tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_len
113-
tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_1
114-
tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_2
115-
tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_3
116-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_1
117-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_2
118-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_3
119-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_4
120-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_5
121-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_6
122-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_7
123-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_8
124-
tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_9
125-
126111
tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmaskDifferentDtypes::test_putmask_differnt_dtypes_raises
127112
tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmask::test_putmask_non_equal_shape_raises
128113

tests/third_party/cupy/indexing_tests/test_generate.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_indices_list1(self, xp, dtype):
2323
def test_indices_list2(self, xp, dtype):
2424
return xp.indices((1, 2, 3, 4), dtype)
2525

26+
@testing.with_requires("numpy>=1.24")
2627
def test_indices_list3(self):
2728
for xp in (numpy, cupy):
2829
with pytest.raises((ValueError, TypeError)):
@@ -49,6 +50,7 @@ def test_ix_bool_ndarray(self, xp):
4950
return xp.ix_(xp.array([True, False] * 2))
5051

5152

53+
@pytest.mark.skip("r_[] is not supported yet")
5254
class TestR_(unittest.TestCase):
5355
@testing.for_all_dtypes()
5456
@testing.numpy_cupy_array_equal()
@@ -66,7 +68,9 @@ def test_r_8(self, xp, dtype):
6668
return xp.r_[a, b, c]
6769

6870
@testing.for_all_dtypes()
69-
@testing.numpy_cupy_array_equal()
71+
@testing.numpy_cupy_array_equal(
72+
type_check=(numpy.lib.NumpyVersion(numpy.__version__) >= "1.25.0")
73+
)
7074
def test_r_2(self, xp, dtype):
7175
a = xp.array([1, 2, 3], dtype)
7276
return xp.r_[a, 0, 0, a]
@@ -100,7 +104,14 @@ def test_r_9(self, dtype):
100104
with self.assertRaises(ValueError):
101105
cupy.r_[a, b]
102106

107+
@testing.numpy_cupy_array_equal(
108+
type_check=(numpy.lib.NumpyVersion(numpy.__version__) >= "1.25.0")
109+
)
110+
def test_r_scalars(self, xp):
111+
return xp.r_[0, 0.5, -1, 0.3]
112+
103113

114+
@pytest.mark.skip("c_[] is not supported yet")
104115
class TestC_(unittest.TestCase):
105116
@testing.for_all_dtypes()
106117
@testing.numpy_cupy_array_equal()
@@ -125,14 +136,15 @@ def test_c_3(self, dtype):
125136
cupy.c_[a, b]
126137

127138

139+
@pytest.mark.skip("no AxisConcatenator is provided")
128140
class TestAxisConcatenator(unittest.TestCase):
129141
def test_AxisConcatenator_init1(self):
130142
with self.assertRaises(TypeError):
131143
generate.AxisConcatenator.__init__()
132144

133145
def test_len(self):
134146
a = generate.AxisConcatenator()
135-
self.assertEqual(len(a), 0)
147+
assert len(a) == 0
136148

137149

138150
class TestUnravelIndex(unittest.TestCase):
@@ -339,11 +351,7 @@ def test_tril_indices_from_3(self, xp, dtype):
339351
@testing.for_all_dtypes()
340352
def test_tril_indices_from_4(self, dtype):
341353
for xp in (numpy, cupy):
342-
if xp is numpy:
343-
error = AttributeError
344-
else:
345-
error = TypeError
346-
with pytest.raises(error):
354+
with pytest.raises((AttributeError, TypeError)):
347355
xp.tril_indices_from(4, k=1)
348356

349357

@@ -394,9 +402,5 @@ def test_triu_indices_from_3(self, xp, dtype):
394402
@testing.for_all_dtypes()
395403
def test_triu_indices_from_4(self, dtype):
396404
for xp in (numpy, cupy):
397-
if xp is numpy:
398-
error = AttributeError
399-
else:
400-
error = TypeError
401-
with pytest.raises(error):
405+
with pytest.raises((AttributeError, TypeError)):
402406
xp.triu_indices_from(4, k=1)

0 commit comments

Comments
 (0)