Skip to content

Commit

Permalink
Fixup smoke test for FindClusters
Browse files Browse the repository at this point in the history
  • Loading branch information
dcollins15 committed Jan 22, 2025
1 parent e4cc892 commit 5221a80
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/testthat/test_find_clusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ context("FindClusters")
test_that("Smoke test for `FindClusters`", {
test_case <- get_test_data()

# Spot check cluster assignments with using defaults.
# Validate cluster assignments using default parameters.
results <- FindClusters(test_case)$seurat_clusters
expect_equal(results[[1]], factor(3, levels=0:5))
expect_equal(results[[15]], factor(4, levels=0:5))
expect_equal(results[[24]], factor(0, levels=0:5))
expect_equal(results[[72]], factor(5, levels=0:5))
expect_equal(results[[length(results)]], factor(2, levels=0:5))
# Check that every cell was assigned to a cluster label.
expect_false(any(is.na(results)))
# Check that the expected cluster labels were assigned.
expect_equal(as.numeric(levels(results)), c(0, 1, 2, 3, 4, 5))
# Check that the cluster sizes match the expected distribution.
expect_equal(
as.numeric(sort(table(results))),
c(9, 10, 10, 11, 20, 20)
)

# Check that every clustering algorithm can be run without errors.
expect_no_error(FindClusters(test_case, algorithm = 1))
Expand Down

0 comments on commit 5221a80

Please sign in to comment.