Skip to content

Commit

Permalink
fix unit-test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Oct 16, 2024
1 parent 5e9ebc0 commit 42c8e3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apis/r/R/SOMANDArrayBase.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SOMANDArrayBase <- R6::R6Class(
resize = function(new_shape) {
stopifnot(
"resize is not supported for dense arrays until tiledbsoma 1.15" =
.dense_arrays_can_have_current_domain || private$.is_sparse,
.dense_arrays_can_have_current_domain() || private$.is_sparse,
"'new_shape' must be a vector of integerish values, of the same length as maxshape" =
rlang::is_integerish(new_shape, n = self$ndim()) ||
(bit64::is.integer64(new_shape) && length(new_shape) == self$ndim())
Expand All @@ -119,7 +119,7 @@ SOMANDArrayBase <- R6::R6Class(
tiledbsoma_upgrade_shape = function(shape) {
stopifnot(
"tiledbsoma_upgrade_shape is not supported for dense arrays until tiledbsoma 1.15" =
.dense_arrays_can_have_current_domain || private$.is_sparse,
.dense_arrays_can_have_current_domain() || private$.is_sparse,
"'shape' must be a vector of integerish values, of the same length as maxshape" =
rlang::is_integerish(shape, n = self$ndim()) ||
(bit64::is.integer64(shape) && length(shape) == self$ndim())
Expand Down
9 changes: 7 additions & 2 deletions apis/r/tests/testthat/test-shape.R
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ test_that("SOMASparseNDArray shape", {

# Test resize up
new_shape <- c(500, 600)
expect_no_error(ndarray$resize(new_shape))
####expect_no_error(ndarray$resize(new_shape))
ndarray$resize(new_shape)

# Test writes within new bounds
soma_dim_0 <- c(200,300)
Expand Down Expand Up @@ -479,7 +480,11 @@ test_that("SOMADenseNDArray shape", {
expect_equal(length(readback_shape), length(readback_maxshape))

if (.new_shape_feature_flag_is_enabled()) {
expect_true(all(readback_shape < readback_maxshape))
if (.dense_arrays_can_have_current_domain()) {
expect_true(all(readback_shape < readback_maxshape))
} else {
expect_true(all(readback_shape == readback_maxshape))
}
} else {
expect_true(all(readback_shape == readback_maxshape))
}
Expand Down

0 comments on commit 42c8e3c

Please sign in to comment.