Skip to content

Commit

Permalink
Add test for array conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
unnonouno committed Aug 2, 2017
1 parent d0df01f commit f4ce630
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/cupy_tests/sparse_tests/test_dia.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,30 @@ def test_duplicated_offsets(self, xp, sp):
offsets = xp.array([1, 1], 'i')
sp.dia_matrix(
(self.data(xp), offsets))


@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64],
}))
@unittest.skipUnless(scipy_available, 'requires scipy')
class TestCooMatrixScipyComparison(unittest.TestCase):

@testing.numpy_cupy_allclose(sp_name='sp')
def test_toarray(self, xp, sp):
m = _make(xp, sp, self.dtype)
return m.toarray()

@testing.numpy_cupy_allclose(sp_name='sp')
def test_tocsc(self, xp, sp):
m = _make(xp, sp, self.dtype)
return m.tocsc().toarray()

@testing.numpy_cupy_allclose(sp_name='sp')
def test_tocsr(self, xp, sp):
m = _make(xp, sp, self.dtype)
return m.tocsr().toarray()

@testing.numpy_cupy_allclose(sp_name='sp')
def test_transpose(self, xp, sp):
m = _make(xp, sp, self.dtype)
return m.transpose().toarray()

0 comments on commit f4ce630

Please sign in to comment.