From 92a43195add04d4d37e365b2f7e189fd20ce0f01 Mon Sep 17 00:00:00 2001 From: Sebastian Pardo Date: Thu, 9 Mar 2017 20:43:11 -0800 Subject: [PATCH] Fix warnings resulting from deprecated testthat functions --- tests/testthat/test-ebirdgeo.R | 2 +- tests/testthat/test-ebirdhotspot.R | 2 +- tests/testthat/test-ebirdloc.R | 8 ++++---- tests/testthat/test-ebirdnotable.R | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-ebirdgeo.R b/tests/testthat/test-ebirdgeo.R index 8a895bb..2d56681 100644 --- a/tests/testthat/test-ebirdgeo.R +++ b/tests/testthat/test-ebirdgeo.R @@ -10,6 +10,6 @@ test_that("ebirdgeo works correctly", { expect_is(egeo$howMany, "integer") expect_is(ebirdgeo(lat = 42, lng = -76, max=10, provisional=TRUE, hotspot=TRUE), "data.frame") expect_equal(nrow(ebirdgeo(lat = 42, lng = -76, max=10, provisional=TRUE, hotspot=TRUE)), 10) - expect_that(ebirdgeo(lat = 40, lng = -120, dist = 50), not(gives_warning())) + expect_silent(ebirdgeo(lat = 40, lng = -120, dist = 50)) expect_warning(ebirdgeo(lat = 30, lng = -120, dist = 100), "Distance supplied was >50km") }) diff --git a/tests/testthat/test-ebirdhotspot.R b/tests/testthat/test-ebirdhotspot.R index 2eccae7..f20c75d 100644 --- a/tests/testthat/test-ebirdhotspot.R +++ b/tests/testthat/test-ebirdhotspot.R @@ -6,7 +6,7 @@ test_that("ebirdhotspot works correctly", { out <- ebirdhotspot('L99381', max=10, provisional=TRUE) expect_is(out, "data.frame") expect_is(out$comName, "character") - expect_that(ebirdhotspot('L99381'), not(gives_warning())) + expect_silent(ebirdhotspot('L99381')) expect_warning(ebirdhotspot(locID = 'L99381', back = 40)) }) diff --git a/tests/testthat/test-ebirdloc.R b/tests/testthat/test-ebirdloc.R index 6803923..8b4f1fc 100644 --- a/tests/testthat/test-ebirdloc.R +++ b/tests/testthat/test-ebirdloc.R @@ -13,10 +13,10 @@ test_that("ebirdloc works correctly", { simpler <- ebirdloc('L99381', max = 1, simple = TRUE) lesssimpler <- ebirdloc('L99381', max = 1, simple = FALSE) - expect_less_than(NCOL(simpler), 15) - expect_that(NCOL(simpler), not(is_less_than(8))) - expect_less_than(NCOL(lesssimpler), 30) - expect_that(NCOL(lesssimpler), not(is_less_than(10))) + expect_lt(NCOL(simpler), 15) + expect_gt(NCOL(simpler), 8) + expect_lt(NCOL(lesssimpler), 30) + expect_gt(NCOL(lesssimpler), 10) }) diff --git a/tests/testthat/test-ebirdnotable.R b/tests/testthat/test-ebirdnotable.R index 3fe1328..e9c80a3 100644 --- a/tests/testthat/test-ebirdnotable.R +++ b/tests/testthat/test-ebirdnotable.R @@ -16,7 +16,7 @@ test_that("ebirdnotable works correctly", { expect_equal(dim(simpler), c(40,11)) # expect_equal(dim(lesssimpler), c(40,24)) - expect_more_than( + expect_gt( system.time(ebirdnotable(lat=42, lng=-70, max = 10, sleep = 1))[[3]] , 1) })