tests/testthat/test_MsBackend.R

test_that("MsBackend methods throw errors", {
    setClass("DummyBackend",
             contains = "MsBackend")
    dm <- new("DummyBackend")

    expect_error(backendInitialize(dm), "not implemented for")
    expect_error(backendMerge(dm), "implemented for")
    expect_error(export(dm), "does not support")
    expect_error(acquisitionNum(dm), "implemented for")
    expect_error(peaksData(dm), "implemented for")
    expect_error(centroided(dm), "implemented for")
    expect_error(centroided(dm) <- TRUE, "implemented for")
    expect_error(collisionEnergy(dm), "implemented for")
    expect_error(collisionEnergy(dm) <- 3, "implemented for")
    expect_error(dataOrigin(dm), "implemented for")
    expect_error(dataOrigin(dm) <- "a", "implemented for")
    expect_error(dataStorage(dm), "implemented for")
    expect_error(dataStorage(dm) <- "a", "implemented for")
    expect_error(filterAcquisitionNum(dm), "implemented for")
    expect_error(intensity(dm), "implemented for")
    expect_error(intensity(dm) <- list(), "implemented for")
    expect_error(ionCount(dm), "implemented for")
    expect_error(isCentroided(dm), "implemented for")
    expect_error(isEmpty(dm), "implemented for")
    expect_error(isolationWindowLowerMz(dm), "implemented for")
    expect_error(isolationWindowLowerMz(dm) <- 3, "implemented for")
    expect_error(isolationWindowTargetMz(dm), "implemented for")
    expect_error(isolationWindowTargetMz(dm) <- 3, "implemented for")
    expect_error(isolationWindowUpperMz(dm), "implemented for")
    expect_error(isolationWindowUpperMz(dm) <- 3, "implemented for")
    expect_error(length(dm), "implemented for")
    expect_error(msLevel(dm), "implemented for")
    expect_error(mz(dm), "implemented for")
    expect_error(mz(dm) <- list(), "implemented for")
    expect_error(lengths(dm), "implemented for")
    expect_error(polarity(dm), "implemented for")
    expect_error(polarity(dm) <- 0, "implemented for")
    expect_error(precScanNum(dm), "implemented for")
    expect_error(precursorCharge(dm), "implemented for")
    expect_error(precursorIntensity(dm), "implemented for")
    expect_error(precursorMz(dm), "implemented for")
    expect_error(peaksData(dm) <- list(), "implemented for")
    expect_error(rtime(dm), "implemented for")
    expect_error(rtime(dm) <- 1.2, "implemented for")
    expect_error(scanIndex(dm), "implemented for")
    expect_error(selectSpectraVariables(dm), "implemented for")
    expect_error(smoothed(dm), "implemented for")
    expect_error(smoothed(dm) <- TRUE, "implemented for")
    expect_error(spectraData(dm), "implemented for")
    expect_error(spectraData(dm) <- DataFrame(), "implemented for")
    expect_error(spectraNames(dm), "implemented for")
    expect_error(spectraNames(dm) <- "a", "implemented for")
    expect_error(spectraVariables(dm), "implemented for")
    expect_error(split(dm, f = 2), "implemented for")
    expect_error(tic(dm), "implemented for")
    expect_error(dm[1], "implemented for")
    expect_error(dm$a, "implemented for")
    expect_error(dm$a <- "a", "implemented for")
})

test_that("reset,MsBackend works", {
    res <- reset(sciex_mzr)
    expect_equal(res, sciex_mzr)
})

Try the Spectra package in your browser

Any scripts or data that you put into this service are public.

Spectra documentation built on Nov. 27, 2020, 2 a.m.