示例#1
0
 def test_extract(self):
     indices, values, shape = sparse.extract(self.data)
     self.assertEqual(indices[0].tolist(),
                      sparse.indices(self.data)[0].tolist())
     self.assertEqual(indices[1].tolist(),
                      sparse.indices(self.data)[1].tolist())
     self.assertEqual(values.tolist(), sparse.values(self.data).tolist())
     self.assertEqual(shape, sparse.shape(self.data))
示例#2
0
 def test_indices(self):
     i0, = sparse.indices(self.data)
     self.assertEqual(i0.tolist(), [4, 4, 3, 2, 1, 2, 3, 0, 0])