tests/testthat/test-dataset_rank_ref.R

test_that("rank_ref", {
  skip_on_cran()
  
  data(rank_ref, package = "taxize")

  expect_is(rank_ref, "data.frame")
  expect_named(rank_ref, c("rankid", "ranks"))
  expect_is(rank_ref$rankid, "character")
  expect_is(rank_ref$ranks, "character")
  expect_gt(NROW(rank_ref), 40)
  
  # rank ids are in order
  z <- sort(as.numeric(rank_ref$rankid))
  expect_identical(z, sort(z))

  # rank name stuff
  w <- rank_ref$ranks
  ## some have commas in them
  expect_true(any(grepl(",", w)))
  ## all are lowercase
  expect_identical(w, tolower(w))
})

Try the taxize package in your browser

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

taxize documentation built on Sept. 11, 2024, 6:13 p.m.