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))
def test_values(self): v = sparse.values(self.data) self.assertEqual(v.tolist(), [10, 20, 1, 30, 40, 50, -1, 0, 60])