Skip to content

Skip vctrs-optional tests #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
@@ -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)

6 changes: 6 additions & 0 deletions tests/testthat/test-vctrs.R
Original file line number Diff line number Diff line change
@@ -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))