tests/testthat/test-selectCells.R

test_that("Supported keys", {
    object <- celloFull
    subset <- selectCells(
        object = object,
        category = "Cancer cell line",
        organism = "Homo sapiens",
        sexOfCell = "Female"
    )
    expect_true(hasRows(subset))
    subset <- selectCells(object = object, sexOfCell = NA)
    expect_true(hasRows(subset))
})

test_that("Expected failures", {
    object <- celloFull
    expect_error(
        object = selectCells(object = object, XXX = "YYY"),
        regexp = "XXX"
    )
    expect_error(
        object = selectCells(object = object, category = "XXX"),
        regexp = "No cell lines"
    )
    expect_error(
        object = selectCells(object = object, category = NA),
        regexp = "No cell lines"
    )
    expect_error(
        object = selectCells(object = object, category = NULL),
        regexp = "No cell lines"
    )
    expect_error(
        object = selectCells(object = object, category = TRUE),
        regexp = "No cell lines"
    )
})
acidgenomics/r-cellosaurus documentation built on March 12, 2024, 2:37 p.m.