tests/testthat/test-get_many.R

library("testthat")

test_that("check if labels are returned correctly when more than one id given, including NA", {
  testthat::skip_if_offline()

  expect_equal(object = {
    tw_get_label(
      id = c(
        "Q180099",
        "Q228822",
        "Not an id",
        "Q180099",
        NA
      ),
      language = "en"
    )
  }, expected = c(
    "Margaret Mead",
    "Ruth Benedict",
    NA,
    "Margaret Mead",
    NA
  ))
})

Try the tidywikidatar package in your browser

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

tidywikidatar documentation built on March 31, 2023, 9:08 p.m.