Skip to content

Commit

Permalink
Optionally skip abind tests (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Nov 6, 2024
1 parent 827d13e commit ae5ec7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-array.r
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-rbind.r
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down

0 comments on commit ae5ec7d

Please sign in to comment.