Skip to content

Commit

Permalink
Test backed csc X as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirshup committed Jun 8, 2019
1 parent 00a409a commit 8bed6fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions anndata/tests/test_hdf5_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ def adata():
},
dtype='int32'
)


@pytest.fixture(params=[sparse.csr_matrix, sparse.csc_matrix])
def sparse_format(request):
return request.param

# -------------------------------------------------------------------------------
# The test functions
# -------------------------------------------------------------------------------
Expand Down Expand Up @@ -145,9 +151,9 @@ def test_backed_modification(adata, backing_h5ad):
assert np.all(adata.X[2, :] == np.array([7, 13, 9]))


def test_backed_modification_sparse(adata, backing_h5ad):
def test_backed_modification_sparse(adata, backing_h5ad, sparse_format):
adata.X[:, 1] = 0 # Make it a little sparse
adata.X = sparse.csr_matrix(adata.X)
adata.X = sparse_format(adata.X)
assert not adata.isbacked

adata.write(backing_h5ad)
Expand Down

0 comments on commit 8bed6fa

Please sign in to comment.