tests/testthat/test-utils.R

test_that("Utils", {
    data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
    sinop <- sits_cube(
        source = "BDC",
        collection = "MOD13Q1-6.1",
        data_dir = data_dir,
        progress = FALSE
    )
    fi <- sinop$file_info[[1]]
    expect_error(length(unique(.by(fi, col = "banda", .fi_timeline))))

    expect_false(.has_name(sinop$source))
})
test_that("rand_sub_tempdir", {
    rand_dir <- .rand_sub_tempdir()
    expect_equal(dirname(rand_dir), tempdir())
})
test_that("Try", {
    expect_error(
        .try({
            sits_cube(
                source = "BDC",
                collection = "MOD13Q1-6.1",
                data_dir = ".",
                progress = FALSE
            )
            .msg_error <- "no cube in directory"
        })
    )
    expect_error(
        .try({
            sits_cube(
                source = "BDC",
                collection = "MOD13Q1-6.1",
                data_dir = ".",
                progress = FALSE
            )
        })
    )
})

Try the sits package in your browser

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

sits documentation built on Sept. 9, 2025, 5:54 p.m.