From af96d1d29a2bf9bc02a309fa817295a0e3946b34 Mon Sep 17 00:00:00 2001 From: James Melville Date: Sat, 20 Apr 2024 14:15:53 -0700 Subject: [PATCH] check matrix package can report its version --- tests/testthat/test_normlaplacian.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test_normlaplacian.R b/tests/testthat/test_normlaplacian.R index 670868a0..0bc498a2 100644 --- a/tests/testthat/test_normlaplacian.R +++ b/tests/testthat/test_normlaplacian.R @@ -31,7 +31,8 @@ test_that("normalized laplacian", { expect_equal(abs(res), abs_expected_norm_lap, tolerance = 0.2) # 115: ensure irlba code path gets tested if we can avoid Matrix ABI issue - if (Matrix::Matrix.Version()$package >= "1.6.3") { + if (exists("Matrix.Version", envir = asNamespace("Matrix")) && + Matrix::Matrix.Version()$package >= "1.6.3") { res <- irlba_tsvd_normalized_laplacian_init(sparse_m) expect_equal(abs(res), abs_expected_norm_lap, tolerance = 0.2)