diff --git a/NEWS.md b/NEWS.md index 446d0ab715..071db3db26 100644 --- a/NEWS.md +++ b/NEWS.md @@ -39,7 +39,8 @@ * Renamed `test-assertthat.R` to `test-utils_checkmate.R`. ### Bug Fixes -* Fixed bugs from tests that rely on `stats::ancova`. They are probably due to an external update. +* Fixed bugs from tests that rely on `stats::ancova`. Adding more general solutions. They + are probably due to an external update. * Fixed tests to respect the new standard print for `NA`. * Fixed error in tests coming from changes in `formatters::var_labels()`. * Identified bug in `prop_diff` functions. Coding of responses have been corrected (TRUE is a success). diff --git a/R/coxph.R b/R/coxph.R index 1706833ece..3a92a89737 100644 --- a/R/coxph.R +++ b/R/coxph.R @@ -320,7 +320,7 @@ s_cox_univariate <- function(formula, lrt <- Map( f = function(without_interaction, with_interaction) { - stats::anova(without_interaction$mod, with_interaction$mod)[2, "Pr(>|Chi|)"] + stats::anova(without_interaction$mod, with_interaction$mod)[2, 4] # Pr(>|Chi|) }, without_interaction = fit[2:(length(covariates) + 1)], with_interaction = fit[-(1:(length(covariates) + 1))] # nolint diff --git a/tests/testthat/test-summarize_ancova.R b/tests/testthat/test-summarize_ancova.R index 12cbb4bdf1..59992236dd 100644 --- a/tests/testthat/test-summarize_ancova.R +++ b/tests/testthat/test-summarize_ancova.R @@ -8,6 +8,10 @@ testthat::test_that("h_ancova works with healthy input", { ) %>% as.data.frame() + # Fixing class differences between versions + exp_class <- "data.frame" + if (inherits(result, "summary_emm")) exp_class <- c("summary_emm", exp_class) + expected <- structure( data.frame( Species = as.factor(c("setosa", "versicolor", "virginica")), @@ -17,7 +21,7 @@ testthat::test_that("h_ancova works with healthy input", { lower.CL = c(5.488497, 5.585349, 5.112255), upper.CL = c(6.821149, 5.849469, 5.700498) ), - class = c("summary_emm", "data.frame"), + class = exp_class, estName = "emmean", clNames = c("lower.CL", "upper.CL"), pri.vars = "Species",