tests/testthat/test_species.R

context("species")

test_that("We can extract generic information from the species table", {
  needs_api()  
  df <- species(c("Oreochromis niloticus", "Bolbometopon muricatum")) 
  expect_is(df, "data.frame")
})


test_that("Check some classes and values of species table", {
  
  needs_api()  
  df <- species(c("Oreochromis niloticus", "Bolbometopon muricatum")) 
  expect_is(df, "data.frame")
 # expect_is(df[["SpecCode"]], "numeric")  #sometimes integer
})


## Test filters
test_that("We can filter on certain fields",{
  needs_api()  
  df <- species(c("Oreochromis niloticus", "Bolbometopon muricatum"), 
                fields=c('SpecCode', 'Species'))
  expect_is(df, "data.frame")
  expect_gt(dim(df)[1], 0)
  
})

Try the rfishbase package in your browser

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

rfishbase documentation built on Sept. 11, 2024, 8:12 p.m.