tests/testthat/test_specimens.R

# Get specimens by datasetid
test_that("Manual loading fails if interactive is false.", {
  skip_on_cran()
  get_specimens(datasetid = c(19832, 41610))
})



# Get specimens by specimenID
test_that("Manual loading fails if interactive is false.", {
  skip_on_cran()
  get_specimens(c(7, 8))
})


# Get specimens from sites object
test_that("Manual loading fails if interactive is false.", {
  skip_on_cran()
  my_sites <- get_sites(c(13296, 5663, 24))
  my_specimens <- get_specimens(my_sites)
})

test_that("Building a specimen works.", {
  dataset <- data.frame(datasetid = 12,
    repo = c("Manhattan", "Banana"),
    taxonid = seq(1, 12))
  # Build error when we pass multiple rows.
  new_spec <- expect_error(build_specimen(dataset))
  new_spec <- expect_is(build_specimen(dataset[1, ]), "specimen")
})

Try the neotoma2 package in your browser

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

neotoma2 documentation built on May 29, 2024, 6:21 a.m.