From 34076409c5465adf6e5987a9132dca706656eb75 Mon Sep 17 00:00:00 2001 From: Andrew Pulsipher Date: Wed, 27 Nov 2024 07:53:06 -0700 Subject: [PATCH 1/3] Add warning to queuing_off for SIRCONN and SEIRCONN which have no queue --- R/model-methods.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/R/model-methods.R b/R/model-methods.R index 57ce2f1..e02bfc4 100644 --- a/R/model-methods.R +++ b/R/model-methods.R @@ -127,6 +127,18 @@ queuing_on.epiworld_model <- function(x) { #' @export queuing_off <- function(x) UseMethod("queuing_off") +#' @export +queuing_off.epiworld_sirconn <- function(x) { + warning("SIR Connected models do not have queue.") + invisible(x) +} + +#' @export +queuing_off.epiworld_seirconn <- function(x) { + warning("SEIR Connected models do not have queue.") + invisible(x) +} + #' @export queuing_off.epiworld_model <- function(x) { invisible(queuing_off_cpp(x)) From ae859e6c889e8485c072c30fb1e0ce05e39f23f4 Mon Sep 17 00:00:00 2001 From: Andrew Pulsipher Date: Wed, 27 Nov 2024 07:55:14 -0700 Subject: [PATCH 2/3] Add queuing_off changes to NAMESPACE --- NAMESPACE | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index aac1efb..492da60 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -71,6 +71,8 @@ S3method(print,epiworld_tool_fun) S3method(print,epiworld_virus) S3method(print,epiworld_virus_fun) S3method(queuing_off,epiworld_model) +S3method(queuing_off,epiworld_seirconn) +S3method(queuing_off,epiworld_sirconn) S3method(queuing_on,epiworld_model) S3method(queuing_on,epiworld_seirconn) S3method(queuing_on,epiworld_sirconn) From 47b267b7eeba391da1bffa8a7caf62aa45f411cc Mon Sep 17 00:00:00 2001 From: Andrew Pulsipher Date: Wed, 27 Nov 2024 07:56:40 -0700 Subject: [PATCH 3/3] Update test-sirconn.R to cover new queuing_off warning --- inst/tinytest/test-sirconn.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/tinytest/test-sirconn.R b/inst/tinytest/test-sirconn.R index 2e3074b..2a88274 100644 --- a/inst/tinytest/test-sirconn.R +++ b/inst/tinytest/test-sirconn.R @@ -40,7 +40,7 @@ expect_length(class(sirconn_0), 2) # Check model run with queuing ------------------------------------------------- expect_silent(verbose_off(sirconn_0)) -expect_warning(queuing_on(sirconn_0)) +expect_warning(queuing_on(sirconn_0), "SIR Connected models do not have queue.") expect_warning(expect_error(plot(sirconn_0))) # Plot fails before model is run expect_silent(run(sirconn_0, ndays = 100, seed = 131)) expect_silent(plot(sirconn_0)) # Plot succeeds after model is run @@ -51,7 +51,7 @@ tmat_queuing <- get_transition_probability(sirconn_0) test_tmat(tmat_queuing) # Check model run without queuing ---------------------------------------------- -expect_silent(queuing_off(sirconn_0)) +expect_warning(queuing_off(sirconn_0), "SIR Connected models do not have queue.") run(sirconn_0, ndays = 100, seed = 131) hist_noqueuing <- get_hist_total(sirconn_0)