Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
unnonouno committed Aug 9, 2017
1 parent 5a76371 commit 8305116
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/cupy_tests/sparse_tests/test_dia.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ def test_ndim(self):
def test_nnz(self):
self.assertEqual(self.m.nnz, 5)

@unittest.skipUnless(scipy_available, 'requires scipy')
def test_str(self):
self.assertEqual(str(self.m), ''' (1, 1)\t1.0
(2, 2)\t2.0
(1, 0)\t3.0
(2, 1)\t4.0''')

def test_toarray(self):
m = self.m.toarray()
expect = [
[0, 0, 0, 0],
[3, 1, 0, 0],
[0, 4, 2, 0]
]
self.assertTrue(m.flags.c_contiguous)
cupy.testing.assert_allclose(m, expect)


@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64],
Expand Down

0 comments on commit 8305116

Please sign in to comment.