Skip to content

Commit

Permalink
Improve code coverage by label_transfer tests
Browse files Browse the repository at this point in the history
Checks if error is correctly raised when no KNN is present in adata.
  • Loading branch information
stefanpeidli committed Sep 30, 2024
1 parent 4d1bf06 commit db24e81
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ def test_label_transfer():
adata = AnnData(X)
perturbations = np.array(["A", "B", "C"] * 22 + ["unknown"] * 3)
adata.obs["perturbation"] = perturbations
sc.pp.neighbors(adata, use_rep="X")
sc.tl.umap(adata)

with pytest.raises(ValueError):
ps = pt.tl.PseudobulkSpace()
ps.label_transfer(adata)

sc.pp.neighbors(adata, use_rep="X")
ps = pt.tl.PseudobulkSpace()
ps.label_transfer(adata)
assert "unknown" not in adata.obs["perturbation"]
Expand Down

0 comments on commit db24e81

Please sign in to comment.