@@ -48,7 +48,6 @@ def test_clustering_subset(adata_neighbors, key):
4848 clustering (adata_neighbors , key_added = key )
4949
5050 for c in adata_neighbors .obs [key ].unique ():
51- print ("Analyzing cluster " , c )
5251 cells_in_c = adata_neighbors .obs [key ] == c
5352 ncells_in_c = adata_neighbors .obs [key ].value_counts ().loc [c ]
5453 key_sub = str (key ) + "_sub"
@@ -71,6 +70,18 @@ def test_clustering_subset(adata_neighbors, key):
7170 assert len (common_cat ) == 0
7271
7372
73+ @pytest .mark .parametrize ("clustering_function" , [rsc .tl .leiden , rsc .tl .louvain ])
74+ @pytest .mark .parametrize ("resolution" , [0.1 , [0.5 , 1.0 ]])
75+ def test_clustering_resolution (adata_neighbors , clustering_function , resolution ):
76+ adata = adata_neighbors .copy ()
77+ clustering_function (adata , key_added = "test_clustering" , resolution = resolution )
78+ if isinstance (resolution , list ):
79+ for r in resolution :
80+ assert f"test_clustering_{ r } " in adata .obs .columns
81+ else :
82+ assert "test_clustering" in adata .obs .columns
83+
84+
7485def test_kmeans_basic (adata_neighbors ):
7586 rsc .tl .kmeans (adata_neighbors )
7687 assert adata_neighbors .obs ["kmeans" ].nunique () == 8
0 commit comments