MCPcopy Create free account
hub / github.com/dask/dask / test_sparse_array

Function test_sparse_array

dask/tests/test_sizeof.py:113–131  ·  view source on GitHub ↗

sizeof() must handle the sparse array API, not just sparse matrices.

()

Source from the content-addressed store, hash-verified

111
112
113def test_sparse_array():
114 """sizeof() must handle the sparse array API, not just sparse matrices."""
115 sparse = pytest.importorskip("scipy.sparse")
116
117 from dask.array.scipy_compat import SCIPY_GE_111
118
119 if not SCIPY_GE_111:
120 pytest.skip(reason="scipy.sparse.sparray required")
121
122 import numpy as np
123
124 sp = sparse.csr_array(np.eye(10))
125 assert sizeof(sp.todia()) >= 152
126 assert sizeof(sp.tobsr()) >= 232
127 assert sizeof(sp.tocoo()) >= 240
128 assert sizeof(sp.tocsc()) >= 232
129 assert sizeof(sp.tocsr()) >= 232
130 assert sizeof(sp.todok()) >= 184
131 assert sizeof(sp.tolil()) >= 204
132
133
134@requires_pandas

Callers

nothing calls this directly

Calls 1

skipMethod · 0.80

Tested by

no test coverage detected