Add tests for columnar slice
import unittest
import numpy
+import pytest
from cupy import testing
@@ -125,6 +126,16 @@ class TestFillDiagonal(unittest.TestCase):
xp.fill_diagonal(a, val=self.val, wrap=self.wrap)
return a
+ @testing.for_all_dtypes()
+ @testing.numpy_cupy_array_equal()
+ def test_columnar_slice(self, xp, dtype): # see cupy#2970
+ if self.shape == (2, 2, 2):
+ pytest.skip(
+ 'The length of each dimension must be the same after slicing')
+ a = testing.shaped_arange(self.shape, xp, dtype)
+ xp.fill_diagonal(a[:,1:], val=self.val, wrap=self.wrap)
+ return a
+
@testing.for_all_dtypes()
@testing.numpy_cupy_raises()
def test_1darray(self, xp, dtype):
