Skip to content

Commit 7b0bf05

Browse files
authored
Make tests more robust again (#165)
* use different, hopefully more robust, coordinates for oc_reverse() tests * reset `oc_rate_sec` option * Update NEWS [skip CI] * ~~find~~ escape braces i.e. double-escape braces in DESCRIPTION so they are not "lost" in the generated package documentation. cf. r-lib/roxygen2#1578
1 parent 4a199e5 commit 7b0bf05

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Authors@R: c(
1212
person("Noam", "Ross", role = "ctb"),
1313
person("Jake", "Russ", role = "ctb"),
1414
person("Julia", "Silge", role = "rev",
15-
comment = "Julia Silge reviewed {opencage} (v. 0.1.0) for rOpenSci, see <https://github.com/ropensci/onboarding/issues/36>.")
15+
comment = "Julia Silge reviewed \\{opencage\\} (v. 0.1.0) for rOpenSci, see <https://github.com/ropensci/onboarding/issues/36>.")
1616
)
1717
Description: Geocode with the OpenCage API, either from place name to
1818
longitude and latitude (forward geocoding) or from longitude and

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
## Internals
1111

1212
* {opencage} now uses [{testthat} 3e](https://testthat.r-lib.org/articles/third-edition.html) for unit tests ([#141](https://github.com/ropensci/opencage/issues/141)).
13-
* GitHub action workflows have been updated ([#142](https://github.com/ropensci/opencage/issues/142), [#149](https://github.com/ropensci/opencage/pull/149), [#152](https://github.com/ropensci/opencage/pull/152)), [#164](https://github.com/ropensci/opencage/pull/164)). Styler, document, and rhub workflows have been added ([#153](https://github.com/ropensci/opencage/pull/153), [#164](https://github.com/ropensci/opencage/pull/164)).
1413
* Use [{lintr} version 3.0](https://www.tidyverse.org/blog/2022/07/lintr-3-0-0/) and add "package development" linters ([#144](https://github.com/ropensci/opencage/pull/144)).
1514
* `countrycodes` source and script were moved to `data-raw` ([#146](https://github.com/ropensci/opencage/pull/146)).
1615
* Add CITATION.cff and a corresponding GitHub action ([#148](https://github.com/ropensci/opencage/pull/148)).
1716
* Select expressions inside `oc_forward_df()` and `oc_reverse_df()` now use `"column"` instead of `.data$column`, because the latter is [deprecated as of tidyselect v1.2.0](https://tidyselect.r-lib.org/news/index.html#tidyselect-120) ([#150](https://github.com/ropensci/opencage/pull/150)).
1817
* The opencage code now uses a consistent style (`styler::tidyverse_style()`) and all internal functions are documented ([#153](https://github.com/ropensci/opencage/pull/153)).
18+
* GitHub action workflows have been updated ([#142](https://github.com/ropensci/opencage/issues/142), [#149](https://github.com/ropensci/opencage/pull/149), [#152](https://github.com/ropensci/opencage/pull/152)), [#164](https://github.com/ropensci/opencage/pull/164)).
19+
* Styler, document, and rhub GitHub action workflows have been added ([#153](https://github.com/ropensci/opencage/pull/153), [#164](https://github.com/ropensci/opencage/pull/164)).
20+
* Tests are updated to reflect changes in API responses ([#163](https://github.com/ropensci/opencage/pull/163), [#165](https://github.com/ropensci/opencage/pull/165))
1921

2022
# opencage 0.2.2
2123

man/opencage-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/helper-opencage.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ oc_fw3 <- function() {
6363

6464
## reverse -----------------------------------------------------------------
6565

66-
oc_lat1 <- function() c(47.21947, 53.55034, 34.05369)
67-
oc_lng1 <- function() c(-1.54754, 10.000654, -118.242767)
66+
oc_lat1 <- function() c(52.087106, 53.55034, 34.05369)
67+
oc_lng1 <- function() c(4.297312, 10.000654, -118.242767)
6868

6969
oc_rev1 <- function() tibble::tibble(id = 1:3, lat = oc_lat1(), lng = oc_lng1())
7070

tests/testthat/test-oc_config.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ test_that("oc_config updates rate limit of oc_get_limit", {
6363
expect_identical(ratelimitr::get_rates(oc_get_limited)[[1]][["n"]], rps)
6464

6565
# set rate_sec back to default: 1L/sec
66+
withr::local_options(oc_rate_sec = NULL)
6667
oc_config()
6768
expect_identical(ratelimitr::get_rates(oc_get_limited)[[1]][["n"]], 1L)
6869
})

tests/testthat/test-oc_reverse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ test_that("tidyeval works for arguments", {
183183
# language
184184
lang <-
185185
oc_reverse_df(oc_rev2(), lat, lng, language = language, output = "all")
186-
expect_identical(lang$oc_country, c("France", "Allemagne", "アメリカ合衆国"))
186+
expect_identical(lang$oc_country, c("Netherlands", "Allemagne", "アメリカ合衆国"))
187187

188188
# no_annotations
189189
ann <-

0 commit comments

Comments
 (0)