tests/testthat/test_extract_data.R

context("extract_data")

test_that("id_rel is correct", {

  expect_error(
    extract_data(c("1", "2")),
    "only one"
  )

  expect_error(
    extract_data("relation/12151"),
    "digits"
  )

})

test_that("exists but not transport line", {

  expect_error(
    extract_data("1"),
    "not found or empty"
  )

  Sys.sleep(2)

  expect_error(
    extract_data("300751"), # type = multipolygon
    "the relation must be tagged `type=route`."
  )

  Sys.sleep(2)

  expect_error(
    extract_data("5370153"), # route = hiking
    "\"route\" tag of the relation must be one of"
  )

})
py-b/osmbus documentation built on Dec. 31, 2020, 2:10 a.m.