()
| 85 | |
| 86 | |
| 87 | def test_meta_from_array_scipy_sparse(): |
| 88 | pytest.importorskip("scipy.sparse") |
| 89 | import scipy.sparse |
| 90 | |
| 91 | # Note: csr_matrix can exclusively have ndim=2 |
| 92 | x = scipy.sparse.csr_matrix([[2, 3]]) |
| 93 | meta = meta_from_array(x) |
| 94 | assert isinstance(meta, type(x)) |
| 95 | |
| 96 | meta = meta_from_array(x, ndim=2) |
| 97 | assert isinstance(meta, type(x)) |
| 98 | assert meta.shape == (0, 0) |
| 99 | |
| 100 | meta = meta_from_array(x, dtype=np.float32) |
| 101 | assert isinstance(meta, type(x)) |
| 102 | assert meta.dtype == np.float32 |
| 103 | |
| 104 | |
| 105 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected
searching dependent graphs…