From d3c8ec2bdf7d68891cb34b305723df55c0199409 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Mon, 20 Jan 2025 20:54:11 -0600 Subject: [PATCH] fix vctrs optional tests --- tests/testthat/test-plot.R | 6 ++++++ tests/testthat/test-vctrs.R | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index 7950b3ca..47df231c 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -1,5 +1,7 @@ test_that("s2_plot works", { + skip_if_not_installed("vctrs") + x <- s2_data_countries() expect_identical(s2_plot(x), x) s2_plot(s2_data_cities(), add = TRUE) @@ -10,6 +12,8 @@ test_that("s2_plot works", { }) test_that("s2_plot works for all examples", { + skip_if_not_installed("vctrs") + for (name in names(s2_data_example_wkt)) { geog <- as_s2_geography(s2_data_example_wkt[[name]]) @@ -22,6 +26,8 @@ test_that("s2_plot works for all examples", { }) test_that("plot() works for vector classes", { + skip_if_not_installed("vctrs") + x <- as_s2_geography("POINT (0 1)") expect_identical(plot(x), x) diff --git a/tests/testthat/test-vctrs.R b/tests/testthat/test-vctrs.R index c149c26d..0cd5b696 100644 --- a/tests/testthat/test-vctrs.R +++ b/tests/testthat/test-vctrs.R @@ -1,5 +1,7 @@ test_that("s2_geography is a vctr", { + skip_if_not_installed("vctrs") + x <- new_s2_geography(list(NULL)) expect_true(vctrs::vec_is(x)) expect_identical(vctrs::vec_data(x), list(NULL)) @@ -8,6 +10,8 @@ test_that("s2_geography is a vctr", { }) test_that("s2_cell is a vctr", { + skip_if_not_installed("vctrs") + x <- new_s2_cell(NA_real_) expect_true(vctrs::vec_is(x)) expect_identical(vctrs::vec_data(x), NA_real_) @@ -16,6 +20,8 @@ test_that("s2_cell is a vctr", { }) test_that("s2_cell_union is a vctr", { + skip_if_not_installed("vctrs") + x <- new_s2_cell_union(list(NULL)) expect_true(vctrs::vec_is(x)) expect_identical(vctrs::vec_data(x), list(NULL))