From 33989346c5cb809790f7114087d505febf497045 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 16 Sep 2024 15:47:45 +0200 Subject: [PATCH] Enable the whole scope of indexing tests in public CI --- .github/workflows/conda-package.yml | 3 +- tests/skipped_tests.tbl | 15 ---------- tests/skipped_tests_gpu.tbl | 15 ---------- .../cupy/indexing_tests/test_generate.py | 28 +++++++++++-------- 4 files changed, 17 insertions(+), 44 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 4481223e0521..c859291ad52f 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -53,8 +53,7 @@ env: third_party/cupy/core_tests third_party/cupy/fft_tests third_party/cupy/creation_tests - third_party/cupy/indexing_tests/test_indexing.py - third_party/cupy/indexing_tests/test_generate.py + third_party/cupy/indexing_tests third_party/cupy/lib_tests third_party/cupy/linalg_tests third_party/cupy/logic_tests diff --git a/tests/skipped_tests.tbl b/tests/skipped_tests.tbl index 3261a0658643..32b50caf7ebe 100644 --- a/tests/skipped_tests.tbl +++ b/tests/skipped_tests.tbl @@ -55,21 +55,6 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_pa tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_max tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_min -tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_AxisConcatenator_init1 -tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_len -tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_1 -tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_2 -tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_3 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_1 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_2 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_3 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_4 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_5 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_6 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_7 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_8 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_9 - tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmaskDifferentDtypes::test_putmask_differnt_dtypes_raises tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmask::test_putmask_non_equal_shape_raises diff --git a/tests/skipped_tests_gpu.tbl b/tests/skipped_tests_gpu.tbl index 7fba58a586c0..3062c7f6498b 100644 --- a/tests/skipped_tests_gpu.tbl +++ b/tests/skipped_tests_gpu.tbl @@ -108,21 +108,6 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_pa tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_max tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_min -tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_AxisConcatenator_init1 -tests/third_party/cupy/indexing_tests/test_generate.py::TestAxisConcatenator::test_len -tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_1 -tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_2 -tests/third_party/cupy/indexing_tests/test_generate.py::TestC_::test_c_3 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_1 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_2 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_3 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_4 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_5 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_6 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_7 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_8 -tests/third_party/cupy/indexing_tests/test_generate.py::TestR_::test_r_9 - tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmaskDifferentDtypes::test_putmask_differnt_dtypes_raises tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmask::test_putmask_non_equal_shape_raises diff --git a/tests/third_party/cupy/indexing_tests/test_generate.py b/tests/third_party/cupy/indexing_tests/test_generate.py index 09287678516f..9486615a1b18 100644 --- a/tests/third_party/cupy/indexing_tests/test_generate.py +++ b/tests/third_party/cupy/indexing_tests/test_generate.py @@ -23,6 +23,7 @@ def test_indices_list1(self, xp, dtype): def test_indices_list2(self, xp, dtype): return xp.indices((1, 2, 3, 4), dtype) + @testing.with_requires("numpy>=1.24") def test_indices_list3(self): for xp in (numpy, cupy): with pytest.raises((ValueError, TypeError)): @@ -49,6 +50,7 @@ def test_ix_bool_ndarray(self, xp): return xp.ix_(xp.array([True, False] * 2)) +@pytest.mark.skip("r_[] is not supported yet") class TestR_(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -66,7 +68,9 @@ def test_r_8(self, xp, dtype): return xp.r_[a, b, c] @testing.for_all_dtypes() - @testing.numpy_cupy_array_equal() + @testing.numpy_cupy_array_equal( + type_check=(numpy.lib.NumpyVersion(numpy.__version__) >= "1.25.0") + ) def test_r_2(self, xp, dtype): a = xp.array([1, 2, 3], dtype) return xp.r_[a, 0, 0, a] @@ -100,7 +104,14 @@ def test_r_9(self, dtype): with self.assertRaises(ValueError): cupy.r_[a, b] + @testing.numpy_cupy_array_equal( + type_check=(numpy.lib.NumpyVersion(numpy.__version__) >= "1.25.0") + ) + def test_r_scalars(self, xp): + return xp.r_[0, 0.5, -1, 0.3] + +@pytest.mark.skip("c_[] is not supported yet") class TestC_(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -125,6 +136,7 @@ def test_c_3(self, dtype): cupy.c_[a, b] +@pytest.mark.skip("no AxisConcatenator is provided") class TestAxisConcatenator(unittest.TestCase): def test_AxisConcatenator_init1(self): with self.assertRaises(TypeError): @@ -132,7 +144,7 @@ def test_AxisConcatenator_init1(self): def test_len(self): a = generate.AxisConcatenator() - self.assertEqual(len(a), 0) + assert len(a) == 0 class TestUnravelIndex(unittest.TestCase): @@ -339,11 +351,7 @@ def test_tril_indices_from_3(self, xp, dtype): @testing.for_all_dtypes() def test_tril_indices_from_4(self, dtype): for xp in (numpy, cupy): - if xp is numpy: - error = AttributeError - else: - error = TypeError - with pytest.raises(error): + with pytest.raises((AttributeError, TypeError)): xp.tril_indices_from(4, k=1) @@ -394,9 +402,5 @@ def test_triu_indices_from_3(self, xp, dtype): @testing.for_all_dtypes() def test_triu_indices_from_4(self, dtype): for xp in (numpy, cupy): - if xp is numpy: - error = AttributeError - else: - error = TypeError - with pytest.raises(error): + with pytest.raises((AttributeError, TypeError)): xp.triu_indices_from(4, k=1)