Running ‘testthat.R’ [13s/158s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(nasapower)
  > 
  > test_check("nasapower")
  Loading required namespace: jsonlite
  [1] "Required column name check:"
  [1] "maxt" "mint" "radn" "rain" "year" "day" 
  [1] TRUE TRUE TRUE TRUE TRUE TRUE
  [1] "WARNING: At least 12 months of data is required to generate tav and amp. Values may be inaccurate."
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  nasapower
   --- call from context --- 
  .check_lonlat(lonlat, pars)
   --- call from argument --- 
  if (lonlat == "GLOBAL") {
      identifier <- "Global"
  } else {
      stop(call. = FALSE, "\nYou have entered an invalid request for `lonlat`.\n")
  }
   --- R stacktrace ---
  where 1: .check_lonlat(lonlat, pars)
  where 2: eval_bare(get_expr(quo), get_env(quo))
  where 3: doTryCatch(return(expr), name, parentenv, handler)
  where 4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 5: tryCatchList(expr, classes, parentenv, handlers)
  where 6: tryCatch({
      code
      NULL
  }, error = function(e) e)
  where 7: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
  where 8: quasi_capture(enquo(object), capture_error, label = label)
  where 9 at testthat/test-internal_functions.R#135: expect_error(.check_lonlat(lonlat, pars))
  where 10: eval(code, test_env)
  where 11: eval(code, test_env)
  where 12: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 15: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 16: doTryCatch(return(expr), name, parentenv, handler)
  where 17: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 18: tryCatchList(expr, classes, parentenv, handlers)
  where 19: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 20: test_code(desc, code, env = parent.frame())
  where 21 at testthat/test-internal_functions.R#121: test_that("check_lonlat properly reports errors", {
      pars <- "T2M"
      lonlat <- c(-27.5, 151.5)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(0, 181)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c("x", 181)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(-90, 90, -181, 181)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(-91, 91, -180, 180)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(-91, 91, -180, 180)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(112.91972, -55.11694, "x", 159.256088)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(-90, 90, 180, -180)
      expect_error(.check_lonlat(lonlat, pars))
      lonlat <- c(90, -90, -180, 180)
      expect_error(.check_lonlat(lonlat, pars))
  })
  where 22: eval(code, test_env)
  where 23: eval(code, test_env)
  where 24: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 27: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 28: doTryCatch(return(expr), name, parentenv, handler)
  where 29: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 30: tryCatchList(expr, classes, parentenv, handlers)
  where 31: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 32: test_code(NULL, exprs, env)
  where 33: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 34: force(code)
  where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          end_context()
      })
  where 36: FUN(X[[i]], ...)
  where 37: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 38: force(code)
  where 39: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 40: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 42: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: test_check("nasapower")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (lonlat, pars) 
  {
      bbox <- NULL
      if (is.numeric(lonlat) & length(lonlat) == 2) {
          if (lonlat[1] < -180 || lonlat[1] > 180) {
              stop(call. = FALSE, "\nPlease check your longitude, `", 
                  paste0(lonlat[1]), "`, to be sure it is valid.\n")
          }
          if (lonlat[2] < -90 || lonlat[2] > 90) {
              stop(call. = FALSE, "\nPlease check your latitude, `", 
                  paste0(lonlat[2]), "`, value to be sure it is valid.\n")
          }
          identifier <- "SinglePoint"
          lon <- lonlat[1]
          lat <- lonlat[2]
      }
      else if (length(lonlat) == 4 && is.numeric(lonlat)) {
          if ((lonlat[[3]] - lonlat[[1]]) * (lonlat[[4]] - lonlat[[2]]) * 
              4 > 100) {
              stop(call. = FALSE, "\nPlease provide correct bounding box values. The bounding box\n", 
                  "can only enclose a max of 10 x 10 region of 0.5 degree values\n", 
                  "or a 5 x 5 region of 1 degree values, (i.e. 100 points total).\n")
          }
          if (any(lonlat[1] < -180 || lonlat[3] < -180 || lonlat[1] > 
              180 || lonlat[3] > 180)) {
              stop(call. = FALSE, "\nPlease check your longitude, `", 
                  lonlat[1], "`, `", lonlat[3], "`, values to be sure they are valid.\n")
          }
          if (any(lonlat[2] < -90 || lonlat[4] < -90 || lonlat[2] > 
              90 || lonlat[4] > 90)) {
              stop(call. = FALSE, "\nPlease check your latitude, `", 
                  lonlat[2], "`, `", lonlat[4], "`, values to be sure they are valid.\n")
          }
          if (lonlat[2] > lonlat[4]) {
              stop(call. = FALSE, "\nThe first `lat` value must be the minimum value.\n")
          }
          if (lonlat[1] > lonlat[3]) {
              stop(call. = FALSE, "\nThe first `lon` value must be the minimum value.\n")
          }
          identifier <- "Regional"
          bbox <- paste(lonlat[2], lonlat[1], lonlat[4], lonlat[3], 
              sep = ",")
      }
      else if (lonlat == "GLOBAL") {
          identifier <- "Global"
      }
      else {
          stop(call. = FALSE, "\nYou have entered an invalid request for `lonlat`.\n")
      }
      if (!is.null(bbox)) {
          lonlat_identifier <- list(bbox, identifier)
          names(lonlat_identifier) <- c("bbox", "identifier")
      }
      else if (identifier == "Global") {
          lonlat_identifier <- list("Global")
          names(lonlat_identifier) <- "identifier"
      }
      else {
          lonlat_identifier <- list(lon, lat, identifier)
          names(lonlat_identifier) <- c("lon", "lat", "identifier")
      }
      return(lonlat_identifier)
  }
  <bytecode: 0x4b800c0>
  <environment: namespace:nasapower>
   --- function search by body ---
  Function .check_lonlat in namespace nasapower has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1