Skip to content

Commit 688c5cd

Browse files
authored
Added test_dims.py to public CI (#1588)
1 parent 8779dab commit 688c5cd

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ env:
3232
third_party/cupy/logic_tests/test_comparison.py
3333
third_party/cupy/logic_tests/test_truth.py
3434
third_party/cupy/manipulation_tests/test_basic.py
35+
third_party/cupy/manipulation_tests/test_dims.py
3536
third_party/cupy/manipulation_tests/test_join.py
3637
third_party/cupy/manipulation_tests/test_rearrange.py
3738
third_party/cupy/manipulation_tests/test_transpose.py

tests/third_party/cupy/manipulation_tests/test_dims.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from tests.third_party.cupy import testing
88

99

10-
@testing.gpu
1110
class TestDims(unittest.TestCase):
1211
def check_atleast(self, func, xp):
1312
a = testing.shaped_arange((), xp)
@@ -55,6 +54,13 @@ def test_broadcast_to(self, xp, dtype):
5554
b = xp.broadcast_to(a, (2, 3, 3, 4))
5655
return b
5756

57+
@testing.numpy_cupy_array_equal()
58+
def test_broadcast_to_int(self, xp):
59+
# Broadcast 0-dim array to 1-dim.
60+
a = xp.array(10, dtype=xp.float32)
61+
b = xp.broadcast_to(a, 10)
62+
return b
63+
5864
@testing.for_all_dtypes()
5965
def test_broadcast_to_fail(self, dtype):
6066
for xp in (numpy, cupy):
@@ -286,7 +292,6 @@ def test_external_squeeze(self, xp):
286292
{"shapes": [(0, 1, 1, 3), (2, 1, 0, 0, 3)]},
287293
{"shapes": [(0, 1, 1, 0, 3), (5, 2, 0, 1, 0, 0, 3), (2, 1, 0, 0, 0, 3)]},
288294
)
289-
@testing.gpu
290295
class TestBroadcast(unittest.TestCase):
291296
def _broadcast(self, xp, dtype, shapes):
292297
arrays = [testing.shaped_arange(s, xp, dtype) for s in shapes]
@@ -296,9 +301,9 @@ def _broadcast(self, xp, dtype, shapes):
296301
def test_broadcast(self, dtype):
297302
broadcast_np = self._broadcast(numpy, dtype, self.shapes)
298303
broadcast_cp = self._broadcast(cupy, dtype, self.shapes)
299-
self.assertEqual(broadcast_np.shape, broadcast_cp.shape)
300-
self.assertEqual(broadcast_np.size, broadcast_cp.size)
301-
self.assertEqual(broadcast_np.nd, broadcast_cp.nd)
304+
assert broadcast_np.shape == broadcast_cp.shape
305+
assert broadcast_np.size == broadcast_cp.size
306+
assert broadcast_np.nd == broadcast_cp.nd
302307

303308
@testing.for_all_dtypes()
304309
@testing.numpy_cupy_array_equal()
@@ -329,7 +334,6 @@ def test_broadcast_arrays(self, xp, dtype):
329334
},
330335
{"shapes": [(0,), (2,)]},
331336
)
332-
@testing.gpu
333337
class TestInvalidBroadcast(unittest.TestCase):
334338
@testing.for_all_dtypes()
335339
def test_invalid_broadcast(self, dtype):

0 commit comments

Comments
 (0)