Skip to content

Commit

Permalink
adds a test for 3 or more cats (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Intron7 authored Apr 9, 2024
1 parent 0d79dbe commit a9074f4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_aggregated.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,18 @@ def test_aggregate_examples(matrix, df, keys, metrics, expected):
print(expected)

assert_equal(expected, result)

def test_factors():
from itertools import product

obs = pd.DataFrame(
product(range(5), range(5), range(5), range(5)), columns=list("abcd")
)
obs.index = [f"cell_{i:04d}" for i in range(obs.shape[0])]
adata = ad.AnnData(
X=cp.arange(obs.shape[0]).reshape(-1, 1),
obs=obs,
)

res = rsc.get.aggregate(adata, by=["a", "b", "c", "d"], func="sum")
cp.testing.assert_array_equal(res.layers["sum"], adata.X)

0 comments on commit a9074f4

Please sign in to comment.