From 3d6b1c4a2dc6e99b31c4f8d1c478254b71eaf881 Mon Sep 17 00:00:00 2001 From: xuewei cao <36172337+xueweic@users.noreply.github.com> Date: Fri, 18 Apr 2025 09:59:53 -0400 Subject: [PATCH] minor fix --- tests/README.md | 1 + tests/testthat/test_colocboost.R | 15 ++++----------- tests/testthat/test_inference.R | 8 ++++---- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/tests/README.md b/tests/README.md index 54c6810..4758617 100644 --- a/tests/README.md +++ b/tests/README.md @@ -28,6 +28,7 @@ This repository contains a comprehensive testing framework for the [colocboost]( - `testthat/`: Directory containing test files - `test_package.R`: Tests for basic package functionality - `test_colocboost.R`: Tests for the main colocalization functions + - `test_inference.R`: Tests for the post inference functions - `test_utils.R`: Tests for utility functions - `test_model.R`: Tests for model fitting and prediction functions - `.github/workflows/`: GitHub Actions workflow configurations diff --git a/tests/testthat/test_colocboost.R b/tests/testthat/test_colocboost.R index e8360bd..e7e7c25 100644 --- a/tests/testthat/test_colocboost.R +++ b/tests/testthat/test_colocboost.R @@ -43,7 +43,6 @@ test_data <- generate_test_data() # Basic test for colocboost functionality with individual data test_that("colocboost runs with individual data", { - skip_on_cran() # Convert Y to list Y_list <- list(test_data$Y[,1], test_data$Y[,2]) @@ -71,7 +70,6 @@ test_that("colocboost runs with individual data", { # Test with summary statistics test_that("colocboost runs with summary statistics", { - skip_on_cran() # Generate summary statistics from the individual data X <- test_data$X @@ -120,7 +118,6 @@ test_that("colocboost runs with summary statistics", { # Test focal outcome functionality test_that("colocboost handles focal outcome correctly", { - skip_on_cran() # Convert Y to list Y_list <- list(test_data$Y[,1], test_data$Y[,2]) @@ -145,7 +142,6 @@ test_that("colocboost handles focal outcome correctly", { # Test get_cos_summary functionality test_that("get_cos_summary returns expected structure", { - skip_on_cran() # Convert Y to list Y_list <- list(test_data$Y[,1], test_data$Y[,2]) @@ -180,7 +176,6 @@ test_that("get_cos_summary returns expected structure", { # Test colocboost_plot functionality (basic call should not error) test_that("colocboost_plot runs without error", { - skip_on_cran() # Convert Y to list Y_list <- list(test_data$Y[,1], test_data$Y[,2]) @@ -199,9 +194,8 @@ test_that("colocboost_plot runs without error", { expect_error(suppressWarnings(colocboost_plot(result)), NA) }) -# Test get_strong_colocalization functionality -test_that("get_strong_colocalization maintains colocboost structure", { - skip_on_cran() +# Test get_robust_colocalization functionality +test_that("get_robust_colocalization maintains colocboost structure", { # Convert Y to list Y_list <- list(test_data$Y[,1], test_data$Y[,2]) @@ -216,7 +210,7 @@ test_that("get_strong_colocalization maintains colocboost structure", { ) # Run get_strong_colocalization - strong_result <- get_strong_colocalization( + strong_result <- get_robust_colocalization( result, cos_npc_cutoff = 0.2, # Lower threshold for testing npc_outcome_cutoff = 0.1 # Lower threshold for testing @@ -231,8 +225,7 @@ test_that("get_strong_colocalization maintains colocboost structure", { # Test error handling with malformed input test_that("colocboost handles missing/invalid inputs appropriately", { - skip_on_cran() - + # Test missing both individual data and summary stats expect_warning(colocboost(), "Error: No individual data") diff --git a/tests/testthat/test_inference.R b/tests/testthat/test_inference.R index 72bb0f1..863456a 100644 --- a/tests/testthat/test_inference.R +++ b/tests/testthat/test_inference.R @@ -82,17 +82,17 @@ test_that("get_cos_summary handles different parameters", { }) # Test for get_strong_colocalization -test_that("get_strong_colocalization filters results correctly", { +test_that("get_robust_colocalization filters results correctly", { # Generate a test colocboost results cb_res <- generate_test_result() # Basic call - expect_error(get_strong_colocalization(cb_res), NA) + expect_error(get_robust_colocalization(cb_res), NA) # With stricter thresholds - expect_error(get_strong_colocalization(cb_res, cos_npc_cutoff = 0.8), NA) + expect_error(get_robust_colocalization(cb_res, cos_npc_cutoff = 0.8), NA) # With p-value threshold - expect_error(get_strong_colocalization(cb_res, pvalue_cutoff = 0.05), NA) + expect_error(get_robust_colocalization(cb_res, pvalue_cutoff = 0.05), NA) }) \ No newline at end of file