From ae5ec7dabae1cfb2fdf2ca88e4c3b2986c929462 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Wed, 6 Nov 2024 08:18:00 -0800 Subject: [PATCH] Optionally skip abind tests (#309) --- tests/testthat/test-array.r | 6 +++--- tests/testthat/test-rbind.r | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-array.r b/tests/testthat/test-array.r index c905ef64..61ca5ca0 100644 --- a/tests/testthat/test-array.r +++ b/tests/testthat/test-array.r @@ -39,16 +39,16 @@ test_that("simple operations equivalent to vectorised form", { }) test_that("array binding is correct", { - library(abind) + skip_if_not_installed("abind") f <- function(x) matrix(x, 2, 2) m2d <- lapply(1:10, f) - m3d <- abind(m2d, along = 0) + m3d <- abind::abind(m2d, along = 0) expect_that(laply(1:10, f), is_equivalent_to(m3d)) f <- function(x) array(x, c(2, 2, 2)) m3d <- lapply(1:10, f) - m4d <- abind(m3d, along = 0) + m4d <- abind::abind(m3d, along = 0) expect_that(laply(1:10, f), is_equivalent_to(m4d)) }) diff --git a/tests/testthat/test-rbind.r b/tests/testthat/test-rbind.r index 0377d45a..dc1ce782 100644 --- a/tests/testthat/test-rbind.r +++ b/tests/testthat/test-rbind.r @@ -139,13 +139,13 @@ test_that("1d arrays treated as vectors", { }) test_that("multidim arrays ok", { - library(abind) + skip_if_not_installed("abind") df <- data.frame(x = 1:3) df$x <- array(1:27, c(3,3,3)) df2 <- rbind.fill(df, df) - expect_equal(dim(df2$x), dim(abind(along=1, df$x, df$x))) - expect_that(df2$x, is_equivalent_to(abind(along=1, df$x, df$x))) + expect_equal(dim(df2$x), dim(abind::abind(along=1, df$x, df$x))) + expect_that(df2$x, is_equivalent_to(abind::abind(along=1, df$x, df$x))) }) test_that("Array column names preserved", {