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