Skip to content

Commit

Permalink
Merge pull request #207 from cvanderaa/master
Browse files Browse the repository at this point in the history
tests: testing .splitSCE()
  • Loading branch information
lgatto authored Apr 10, 2024
2 parents 39acff1 + 9ecd90d commit c895bbc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test_readQFeatures.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,22 @@ test_that("readSummarizedExperiment", {
)
expect_true(inherits(ft1, "SummarizedExperiment"))
})

test_that(".splitSE", {
m <- matrix(1:100, ncol = 10,
dimnames = list(paste0("row", 1:10),
paste0("col", 1:10)))
se <- SummarizedExperiment(assay = m,
rowData = DataFrame(rowDataCol = 1:nrow(m)%%3),
colData = DataFrame(colvar = 1:ncol(m)%%5))
## Split by row
expect_identical(length(.splitSE(se, "rowDataCol")), 3L)
## Split by col
expect_identical(length(.splitSE(se, "colvar")), 5L)
## Error: variable not found
expect_error(.splitSE(se, "foo"),
regexp = "not found")
## Error: factor is too short
expect_error(.splitSE(se, factor(1:3)),
regexp = "not compatible with dim")
})

0 comments on commit c895bbc

Please sign in to comment.