tests/testthat/test-gisco_get_education.R

test_that("Education online", {
  skip_on_cran()
  skip_if_gisco_offline()

  expect_silent(gisco_get_education(country = "LU", cache = FALSE))
  expect_silent(gisco_get_education(country = "Denmark"))
  expect_message(gisco_get_education(verbose = TRUE, country = "BE"))

  # Several countries
  nn <- gisco_get_education(country = c("LU", "DK", "BE"))

  expect_length(unique(nn$cntr_id), 3)

  # Full
  eufull <- gisco_get_education()

  expect_gt(length(unique(eufull$cntr_id)), 10)
})

test_that("Offline", {
  options(giscoR_test_offline = TRUE)
  expect_message(
    n <- gisco_get_education(update_cache = TRUE),
    "not reachable"
  )
  expect_null(n)
  options(giscoR_test_offline = FALSE)
})

Try the giscoR package in your browser

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

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