filter combination instead of skip
@@ -408,7 +408,20 @@ def skip_HIP_0_size_matrix():
return decorator
-@testing.parameterize(*testing.product({
+def _check_bounds(indices, n_rows, n_cols, **kwargs):
+ if not isinstance(indices, tuple):
+ indices = (indices,)
+ for index, size in zip(indices, [n_rows, n_cols]):
+ if isinstance(index, list):
+ for ind in index:
+ if not (0 <= ind < size):
+ # CuPy does not check boundaries.
+ # pytest.skip('Out of bounds')
+ return False
+ return True
+
+
+@testing.parameterize(*[params for params in testing.product({
'format': ['csr', 'csc'],
'density': [0.0, 0.5],
'n_rows': [1, 25],
@@ -434,23 +447,11 @@ def skip_HIP_0_size_matrix():
([2, 0, 2], [2, 1, 2]),
]
)
-}))
+}) if _check_bounds(**params)])
@testing.with_requires('scipy>=1.4.0')
@testing.gpu
class TestArrayIndexing(IndexingTestBase):
- @pytest.fixture(autouse=True)
- def setUp(self):
- indices = self.indices
- if not isinstance(indices, tuple):
- indices = (indices,)
- for index, size in zip(indices, [self.n_rows, self.n_cols]):
- if isinstance(index, list):
- for ind in index:
- if not (0 <= ind < size):
- # CuPy does not check boundaries.
- pytest.skip('Out of bounds')
-
@skip_HIP_0_size_matrix()
@testing.for_dtypes('fdFD')
@testing.numpy_cupy_array_equal(
