Skip to content

Commit

Permalink
Update skips on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Oct 21, 2021
1 parent e5375f0 commit 8bb7972
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 27 deletions.
8 changes: 5 additions & 3 deletions tests/testthat/test-geo_address_lookup.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test_that("Returning empty query", {
expect_message(geo_address_lookup("xbzbzbzoa aiaia", "R"))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- geo_address_lookup("xbzbzbzoa aiaia", "R")

Expand All @@ -12,19 +12,21 @@ test_that("Returning empty query", {
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(geo_address_lookup(34633854, "W")))
expect_false(inherits(geo_address_lookup(34633854, "W"), "sf"))
# this is _not_ a _sf function
})

test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(geo_address_lookup(34633854, "W")), 4)
expect_gt(ncol(geo_address_lookup(34633854, "W", full_results = TRUE)), 4)
Expand Down
9 changes: 6 additions & 3 deletions tests/testthat/test-geo_address_lookup_sf.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
test_that("Returning empty query", {
expect_message(geo_address_lookup_sf("xbzbzbzoa aiaia", "R"))
skip_if_api_server()

skip_on_cran()
skip_if_api_server()


obj <- geo_address_lookup_sf("xbzbzbzoa aiaia", "R")

Expand All @@ -11,18 +13,19 @@ test_that("Returning empty query", {
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()

expect_true(is.data.frame(geo_address_lookup_sf(34633854, "W")))
expect_s3_class(geo_address_lookup_sf(34633854, "W"), "sf")
})

test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(geo_address_lookup_sf(34633854, "W")), 3)
expect_gt(ncol(geo_address_lookup_sf(34633854, "W", full_results = TRUE)), 3)
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-geo_amenity.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ test_that("Returning empty query", {
amenity = "xbzbzbzoa aiaia"
))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- geo_amenity_sf(
bbox = c(-1.1446, 41.5022, -0.4854, 41.8795),
Expand All @@ -18,9 +18,10 @@ test_that("Returning empty query", {
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(geo_amenity(
bbox = c(-1.1446, 41.5022, -0.4854, 41.8795),
Expand All @@ -33,9 +34,10 @@ test_that("Data format", {
})

test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(geo_amenity(
bbox = c(-1.1446, 41.5022, -0.4854, 41.8795),
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-geo_amenity_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ test_that("Returning empty query", {
amenity = "xbzbzbzoa aiaia"
))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- geo_amenity_sf(
bbox = c(-1.1446, 41.5022, -0.4854, 41.8795),
Expand All @@ -17,9 +17,10 @@ test_that("Returning empty query", {
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(geo_amenity_sf(
bbox = c(-1.1446, 41.5022, -0.4854, 41.8795),
Expand All @@ -33,9 +34,10 @@ test_that("Data format", {


test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(geo_amenity_sf(
bbox = c(-1.1446, 41.5022, -0.4854, 41.8795),
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-geo_lite.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test_that("Returning empty query", {
expect_message(geo_lite("xbzbzbzoa aiaia"))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- geo_lite("xbzbzbzoa aiaia")

Expand All @@ -12,9 +12,10 @@ test_that("Returning empty query", {
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(geo_lite("Madrid")))
expect_false(inherits(geo_lite("Madrid"), "sf"))
Expand All @@ -23,9 +24,10 @@ test_that("Data format", {


test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(geo_lite(c("Madrid", "Barcelona"))), 4)
expect_gt(ncol(geo_lite("Madrid", full_results = TRUE)), 4)
Expand Down
11 changes: 7 additions & 4 deletions tests/testthat/test-geo_lite_sf.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test_that("Returning empty query", {
expect_message(geo_lite_sf("xbzbzbzoa aiaia"))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- geo_lite_sf("xbzbzbzoa aiaia")

Expand All @@ -11,18 +11,20 @@ test_that("Returning empty query", {
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(geo_lite_sf("Madrid")))
expect_s3_class(geo_lite_sf("Madrid"), "sf")
})

test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(geo_lite_sf(c("Madrid", "Barcelona"))), 3)
expect_gt(ncol(geo_lite_sf("Madrid", full_results = TRUE)), 3)
Expand All @@ -40,9 +42,10 @@ test_that("Checking query", {
})

test_that("Checking geometry type", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(
sf::st_geometry_type(geo_lite_sf("Pentagon")) == "POINT"
Expand Down
11 changes: 7 additions & 4 deletions tests/testthat/test-reverse_geo_lite.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test_that("Returning empty query", {
expect_message(reverse_geo_lite(200, 200))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- reverse_geo_lite(200, 200)

Expand All @@ -11,28 +11,31 @@ test_that("Returning empty query", {
})

test_that("Returning error", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_error(reverse_geo_lite(0, c(2, 3)))
expect_error(reverse_geo_lite("a", "a"))
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(reverse_geo_lite(0, 0)))
expect_false(inherits(reverse_geo_lite(0, 0), "sf"))
# this is _not_ a _sf function
})

test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(reverse_geo_lite(0, 0)), 3)
expect_gt(ncol(reverse_geo_lite(0, 0, full_results = TRUE)), 3)
Expand Down
11 changes: 7 additions & 4 deletions tests/testthat/test-reverse_geo_lite_sf.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test_that("Returning empty query", {
expect_message(reverse_geo_lite_sf(200, 200))

skip_if_api_server()
skip_on_cran()
skip_if_api_server()

obj <- reverse_geo_lite_sf(200, 200)

Expand All @@ -11,27 +11,30 @@ test_that("Returning empty query", {
})

test_that("Returning error", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_error(reverse_geo_lite_sf(0, c(2, 3)))
expect_error(reverse_geo_lite_sf("a", "a"))
})

test_that("Data format", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_true(is.data.frame(reverse_geo_lite_sf(0, 0)))
expect_s3_class(reverse_geo_lite_sf(0, 0), "sf")
})

test_that("Checking query", {
skip_on_cran()
skip_if_api_server()
skip_if_offline()
skip_on_cran()


expect_equal(ncol(reverse_geo_lite_sf(0, 0)), 4)
expect_gt(ncol(reverse_geo_lite_sf(0, 0,
Expand Down

0 comments on commit 8bb7972

Please sign in to comment.