From db8ab03fcbdedcfe786b54260d27bba4c1e053dd Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 11 Jul 2024 07:16:52 +0200 Subject: [PATCH] Remove unnecessary `tryCatch()` statements targeting `insight::download_model()` (#746) --- DESCRIPTION | 16 ++++++++-------- tests/testthat/test-icc.R | 6 +++--- tests/testthat/test-model_performance.bayesian.R | 16 ++++++++-------- tests/testthat/test-model_performance.merMod.R | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d8b0da72d..3807dda9c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Type: Package Package: performance Title: Assessment of Regression Models Performance Version: 0.12.0.8 -Authors@R: +Authors@R: c(person(given = "Daniel", family = "Lüdecke", role = c("aut", "cre"), @@ -39,8 +39,8 @@ Authors@R: email = "remi.theriault@mail.mcgill.ca", comment = c(ORCID = "0000-0003-4315-6788", Twitter = "@rempsyc")), person(given = "Vincent", - family = "Arel-Bundock", - email = "vincent.arel-bundock@umontreal.ca", + family = "Arel-Bundock", + email = "vincent.arel-bundock@umontreal.ca", role = "ctb", comment = c(ORCID = "0000-0003-2042-7063")), person(given = "Martin", @@ -48,9 +48,9 @@ Authors@R: role = "rev"), person(given = "gjo11", role = "rev"), - person("Etienne", - "Bacher", , - "etienne.bacher@protonmail.com", + person("Etienne", + "Bacher", , + "etienne.bacher@protonmail.com", role = "ctb", comment = c(ORCID = "0000-0002-9271-5075"))) Maintainer: Daniel Lüdecke @@ -93,7 +93,7 @@ Suggests: DHARMa, estimatr, fixest, - flextable, + flextable, forecast, ftExtra, gamm4, @@ -101,7 +101,7 @@ Suggests: glmmTMB, graphics, Hmisc, - httr, + httr2, ICS, ICSOutlier, ISLR, diff --git a/tests/testthat/test-icc.R b/tests/testthat/test-icc.R index efbb30eb6..e537b8b1f 100644 --- a/tests/testthat/test-icc.R +++ b/tests/testthat/test-icc.R @@ -40,7 +40,7 @@ test_that("icc", { skip_on_cran() skip_if_not_installed("curl") skip_if_offline() - skip_if_not_installed("httr") + skip_if_not_installed("httr2") m2 <- insight::download_model("stanreg_lmerMod_1") expect_equal( icc(m2), @@ -57,7 +57,7 @@ test_that("icc", { skip_on_cran() skip_if_not_installed("curl") skip_if_offline() - skip_if_not_installed("httr") + skip_if_not_installed("httr2") m3 <- insight::download_model("brms_mixed_1") set.seed(123) expect_equal( @@ -71,7 +71,7 @@ test_that("icc", { skip_on_cran() skip_if_not_installed("curl") skip_if_offline() - skip_if_not_installed("httr") + skip_if_not_installed("httr2") m3 <- insight::download_model("brms_mixed_1") set.seed(123) expect_equal( diff --git a/tests/testthat/test-model_performance.bayesian.R b/tests/testthat/test-model_performance.bayesian.R index a15e41a10..da4b6ff18 100644 --- a/tests/testthat/test-model_performance.bayesian.R +++ b/tests/testthat/test-model_performance.bayesian.R @@ -2,9 +2,9 @@ test_that("model_performance.stanreg", { skip_on_cran() skip_if_not_installed("curl") skip_if_offline() - skip_if_not_installed("httr") + skip_if_not_installed("httr2") set.seed(333) - model <- tryCatch(insight::download_model("stanreg_lm_1"), error = function(e) NULL) + model <- insight::download_model("stanreg_lm_1") skip_if(is.null(model)) perf <- model_performance(model) @@ -12,7 +12,7 @@ test_that("model_performance.stanreg", { expect_equal(perf$R2_adjusted, 0.7162912, tolerance = 1e-3) expect_equal(perf$ELPD, -83.49838, tolerance = 1e-3) - model <- tryCatch(insight::download_model("stanreg_lm_2"), error = function(e) NULL) + model <- insight::download_model("stanreg_lm_2") skip_if(is.null(model)) perf <- model_performance(model) @@ -20,7 +20,7 @@ test_that("model_performance.stanreg", { expect_equal(perf$R2_adjusted, 0.7979026, tolerance = 1e-3) expect_equal(perf$ELPD, -78.38735, tolerance = 1e-3) - model <- tryCatch(insight::download_model("stanreg_lmerMod_1"), error = function(e) NULL) + model <- insight::download_model("stanreg_lmerMod_1") skip_if(is.null(model)) perf <- model_performance(model) @@ -34,10 +34,10 @@ test_that("model_performance.brmsfit", { skip_on_cran() skip_if_not_installed("curl") skip_if_offline() - skip_if_not_installed("httr") + skip_if_not_installed("httr2") set.seed(333) - model <- tryCatch(insight::download_model("brms_1"), error = function(e) NULL) + model <- insight::download_model("brms_1") skip_if(is.null(model)) expect_message({ perf <- model_performance(model) @@ -50,7 +50,7 @@ test_that("model_performance.brmsfit", { "RMSE", "Sigma" )) - model <- tryCatch(insight::download_model("brms_mixed_4"), error = function(e) NULL) + model <- insight::download_model("brms_mixed_4") skip_if(is.null(model)) expect_message({ perf <- model_performance(model) @@ -63,7 +63,7 @@ test_that("model_performance.brmsfit", { "R2_adjusted", "R2_adjusted_marginal", "ICC", "RMSE", "Sigma" )) - model <- tryCatch(insight::download_model("brms_ordinal_1"), error = function(e) NULL) + model <- insight::download_model("brms_ordinal_1") skip_if(is.null(model)) perf <- suppressWarnings(model_performance(model)) expect_equal(perf$R2, 0.8760015, tolerance = 1e-3) diff --git a/tests/testthat/test-model_performance.merMod.R b/tests/testthat/test-model_performance.merMod.R index 0c70da3c3..82360de46 100644 --- a/tests/testthat/test-model_performance.merMod.R +++ b/tests/testthat/test-model_performance.merMod.R @@ -2,7 +2,7 @@ test_that("model_performance.merMod", { skip_on_cran() skip_if_not_installed("curl") skip_if_offline() - skip_if_not_installed("httr") + skip_if_not_installed("httr2") model <- insight::download_model("lmerMod_1") expect_equal(model_performance(model, estimator = "ML")$AIC, AIC(logLik(model, REML = FALSE)), tolerance = 0.01)