Skip to content

Commit

Permalink
Merge pull request #282 from jmaspons/fix-opq_osm_id
Browse files Browse the repository at this point in the history
Fix opq_osm_id for more than 1 id
  • Loading branch information
mpadge committed Nov 28, 2022
2 parents 39d7994 + e4a5c9f commit 30d65f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions R/opq.R
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,9 @@ opq_osm_id <- function (id = NULL, type = NULL, open_url = FALSE) {
if (!(is.character (id) | storage.mode (id) == "double")) {
stop ("id must be character or numeric.")
}
if (length (id) != 1L) {
stop ("Only a single id may be entered.")
}

if (!is.character (id)) {
id <- paste0 (id)
id <- as.character(id)
}

opq <- opq (1:4)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-opq.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ test_that ("opq_osm_id", {
opq_osm_id (type = "node", id = 1L),
"id must be character or numeric."
)
expect_error (
expect_s3_class (
opq_osm_id (type = "node", id = 1:2 + 0.1),
"Only a single id may be entered."
"overpass_query"
)
expect_identical(
opq_osm_id (type = "node", id = 123456),
Expand Down

0 comments on commit 30d65f7

Please sign in to comment.