From d5c6264e92d2d4c4c5e83a0d46bffa2c9241b279 Mon Sep 17 00:00:00 2001 From: Melkiades Date: Thu, 25 Aug 2022 14:43:20 +0200 Subject: [PATCH 1/9] adapting to the new standard --- tests/testthat/test-response_subgroups.R | 5 +++-- tests/testthat/test-summarize_variables.R | 16 ++++++++-------- .../testthat/test-survival_duration_subgroups.R | 2 +- tests/testthat/test-table_egt01.R | 6 +++--- tests/testthat/test-table_lbt01.R | 4 ++-- tests/testthat/test-table_vst01.R | 6 +++--- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/tests/testthat/test-response_subgroups.R b/tests/testthat/test-response_subgroups.R index 03b1e802c0..9395a57872 100644 --- a/tests/testthat/test-response_subgroups.R +++ b/tests/testthat/test-response_subgroups.R @@ -366,10 +366,10 @@ testthat::test_that("tabulate_rsp_subgroups functions as expected when 0 obs in "n", "100", "", "50", "23", "19", "7", "1", "B: Placebo", "Response (%)", "71.0%", "", "66.0%", "65.2%", "78.9%", "100.0%", "100.0%", "A: Drug X", "n", "100", "", "56", "26", "15", "3", "0", "A: Drug X", "Response (%)", - "90.0%", "", "87.5%", "92.3%", "100.0%", "66.7%", "NA%", " ", "Odds Ratio", + "90.0%", "", "87.5%", "92.3%", "100.0%", "66.7%", "NA", " ", "Odds Ratio", "3.68", "", "3.61", "6.40", ">999.99", "<0.01", "NA", " ", "95% CI", "(1.68, 8.04)", "", "(1.35, 9.65)", "(1.19, 34.29)", "(0.00, >999.99)", - "(0.00, >999.99)", "(NA, NA)", " ", "p-value (Chi-Squared Test)", + "(0.00, >999.99)", "NA", " ", "p-value (Chi-Squared Test)", "0.0007", "", "0.0083", "0.0189", "0.0585", "0.1074", "NA" ), .Dim = c(9L, 9L) @@ -401,3 +401,4 @@ testthat::test_that("d_rsp_subgroups_colvars functions as expected with valid in testthat::expect_equal(result, expected) }) + diff --git a/tests/testthat/test-summarize_variables.R b/tests/testthat/test-summarize_variables.R index ae046e2470..6ab477224a 100644 --- a/tests/testthat/test-summarize_variables.R +++ b/tests/testthat/test-summarize_variables.R @@ -407,12 +407,12 @@ testthat::test_that("create_afun_summary creates an `afun` that works", { "", "2", "2 (100%)", "0", "0", "", "", "2", "6", "5.0 - 8.0", "(-12.56, 25.56)", "", "2", "2 (100%)", "0", "0", "", "", "2", "6", "4.0 - 7.0", "(-13.56, 24.56)", "", "2", "2 (100%)", "0", "0", "B", "", "", "1", "3", "3.0 - 3.0", - "(NA, NA)", "", "2", "0", "2 (100%)", "0", "", "", "1", "2", - "2.0 - 2.0", "(NA, NA)", "", "2", "0", "2 (100%)", "0", "", "", "1", - "1", "1.0 - 1.0", "(NA, NA)", "", "2", "0", "2 (100%)", "0", "C", - "", "", "0", "NA", "NA - NA", "(NA, NA)", "", "2", "0", "0", - "2 (100%)", "", "", "0", "NA", "NA - NA", "(NA, NA)", "", "2", - "0", "0", "2 (100%)", "", "", "0", "NA", "NA - NA", "(NA, NA)", + "NA", "", "2", "0", "2 (100%)", "0", "", "", "1", "2", + "2.0 - 2.0", "NA", "", "2", "0", "2 (100%)", "0", "", "", "1", + "1", "1.0 - 1.0", "NA", "", "2", "0", "2 (100%)", "0", "C", + "", "", "0", "NA", "NA", "NA", "", "2", "0", "0", + "2 (100%)", "", "", "0", "NA", "NA", "NA", "", "2", + "0", "0", "2 (100%)", "", "", "0", "NA", "NA", "NA", "", "2", "0", "0", "2 (100%)" ), .Dim = c(34L, 4L) @@ -470,7 +470,7 @@ testthat::test_that("`summarize_vars` works with healthy input, alternative `na. expected <- structure( c( "", "n", "Mean (SD)", "Median", "Min - Max", "all obs", - "6", "NA (NA)", "NA", "NA - NA" + "6", "NA", "NA", "NA" ), .Dim = c(5L, 2L) ) @@ -632,7 +632,7 @@ testthat::test_that("`summarize_vars` works with empty named numeric variables", result_matrix <- to_string_matrix(result) expected_matrix <- structure( c( - "", "n", "Mean (SD)", "Median", "Min - Max", "a", "0", "NA (NA)", "NA", "NA - NA", + "", "n", "Mean (SD)", "Median", "Min - Max", "a", "0", "NA", "NA", "NA", "b", "2", "3.5 (0.7)", "3.5", "3.0 - 4.0", "c", "2", "5.5 (0.7)", "5.5", "5.0 - 6.0" ), .Dim = c(5:4) diff --git a/tests/testthat/test-survival_duration_subgroups.R b/tests/testthat/test-survival_duration_subgroups.R index aac6dcba7d..c9cc67b162 100644 --- a/tests/testthat/test-survival_duration_subgroups.R +++ b/tests/testthat/test-survival_duration_subgroups.R @@ -426,7 +426,7 @@ testthat::test_that("tabulate_survival_subgroups functions as expected when one "1260.5", "", "1274.8", "1327.8", "774.7", "849.3", "NA", "NA", " ", "Hazard Ratio", "0.72", "", "0.75", "0.63", "0.69", "1.01", "NA", "NA", " ", "95% Wald CI", "(0.53, 0.98)", "", "(0.48, 1.17)", - "(0.32, 1.25)", "(0.35, 1.35)", "(0.28, 3.61)", "(NA, NA)", "(NA, NA)", + "(0.32, 1.25)", "(0.35, 1.35)", "(0.28, 3.61)", "NA", "NA", " ", "p-value (log-rank)", "0.0334", "", "0.2012", "0.1832", "0.2745", "0.9839", "NA", "NA" ), diff --git a/tests/testthat/test-table_egt01.R b/tests/testthat/test-table_egt01.R index 9355a35603..e95188e598 100644 --- a/tests/testthat/test-table_egt01.R +++ b/tests/testthat/test-table_egt01.R @@ -42,7 +42,7 @@ testthat::test_that("EGT01 default variant is produced correctly", { "69.3", "22.3 - 116.5", "", "134", "66.4 (19.7)", "65.4", "23.9 - 110.4", "", "134", "46.2 (12.2)", "47.3", "8.5 - 85.6", "", "134", "91.7 (13.9)", "90.0", "54.0 - 131.7", "A: Drug X", "Absolute Change from Baseline", - "", "0", "NA (NA)", "NA", "NA - NA", "", "134", "-1.3 (26.0)", + "", "0", "NA", "NA", "NA", "", "134", "-1.3 (26.0)", "-2.2", "-51.0 - 89.2", "", "134", "-1.1 (26.3)", "-1.1", "-85.0 - 67.5", "", "134", "-3.2 (28.7)", "-2.2", "-81.2 - 72.6", "", "134", "-1.4 (26.6)", "-4.5", "-58.1 - 77.3", "", "134", "-5.0 (27.1)", @@ -55,7 +55,7 @@ testthat::test_that("EGT01 default variant is produced correctly", { "", "134", "71.3 (18.9)", "70.9", "25.9 - 125.7", "", "134", "47.1 (14.1)", "47.3", "9.2 - 83.0", "", "134", "93.5 (14.4)", "91.0", "63.6 - 130.4", "B: Placebo", "Absolute Change from Baseline", - "", "0", "NA (NA)", "NA", "NA - NA", "", "134", "-0.4 (29.7)", + "", "0", "NA", "NA", "NA", "", "134", "-0.4 (29.7)", "-0.5", "-68.2 - 88.4", "", "134", "1.3 (31.4)", "-0.3", "-73.1 - 81.4", "", "134", "-0.9 (30.1)", "1.2", "-73.0 - 103.3", "", "134", "1.8 (30.3)", "-0.9", "-64.3 - 85.3", "", "134", "1.4 (27.1)", "0.6", "-71.2 - 67.4", @@ -67,7 +67,7 @@ testthat::test_that("EGT01 default variant is produced correctly", { "71.0 (20.6)", "70.5", "10.4 - 117.3", "", "132", "71.3 (18.6)", "73.3", "23.9 - 117.2", "", "132", "47.4 (12.6)", "48.2", "10.4 - 80.4", "", "132", "92.6 (12.1)", "93.4", "65.7 - 120.5", "C: Combination", - "Absolute Change from Baseline", "", "0", "NA (NA)", "NA", "NA - NA", + "Absolute Change from Baseline", "", "0", "NA", "NA", "NA", "", "132", "-0.7 (27.8)", "-0.8", "-68.2 - 67.2", "", "132", "-0.1 (28.6)", "-1.5", "-67.7 - 66.3", "", "132", "1.5 (27.3)", "0.1", "-64.5 - 72.5", "", "132", "1.7 (29.6)", "3.8", "-65.9 - 105.7", diff --git a/tests/testthat/test-table_lbt01.R b/tests/testthat/test-table_lbt01.R index bd45c13735..5ff8d61ac4 100644 --- a/tests/testthat/test-table_lbt01.R +++ b/tests/testthat/test-table_lbt01.R @@ -43,11 +43,11 @@ testthat::test_that("LBT01 default variant is produced correctly", { "0.3 (5.8)", "0.5", "-16.0 - 16.3", "", "134", "0.6 (6.5)", "0.4", "-17.0 - 18.8", "", "134", "0.6 (6.1)", "0.9", "-16.0 - 16.1", "B: Placebo", "Analysis Value", "", "134", "20.2 (4.2)", "20.1", "8.1 - 34.6", "", "0", - "NA (NA)", "NA", "NA - NA", "", "134", "20.1 (4.3)", "20.0", "7.2 - 30.5", + "NA", "NA", "NA", "", "134", "20.1 (4.3)", "20.0", "7.2 - 30.5", "", "134", "19.8 (3.9)", "19.9", "11.9 - 28.2", "", "134", "19.6 (4.3)", "19.2", "11.5 - 32.0", "", "134", "19.9 (4.2)", "20.1", "10.3 - 29.1", "B: Placebo", "Absolute Change from Baseline", "", "134", "0.0 (0.0)", - "0.0", "0.0 - 0.0", "", "0", "NA (NA)", "NA", "NA - NA", "", "134", + "0.0", "0.0 - 0.0", "", "0", "NA", "NA", "NA", "", "134", "-0.0 (6.3)", "-0.4", "-18.4 - 14.4", "", "134", "-0.3 (5.6)", "-0.2", "-18.5 - 15.0", "", "134", "-0.5 (6.3)", "-1.2", "-16.6 - 17.2", "", "134", "-0.3 (6.3)", "0.7", "-19.0 - 12.6", "C: Combination", "Analysis Value", diff --git a/tests/testthat/test-table_vst01.R b/tests/testthat/test-table_vst01.R index 2395aa14c4..d279225661 100644 --- a/tests/testthat/test-table_vst01.R +++ b/tests/testthat/test-table_vst01.R @@ -86,7 +86,7 @@ testthat::test_that("VST01 default variant is produced correctly", { "", "134", "50.6 (7.5)", "49.4", "35.1 - 72.2", "", "134", "50.6 (7.5)", "49.4", "35.1 - 72.2", "", "134", "41.6 (4.8)", "42.1", "29.1 - 54.2", "", "134", "60.0 (4.9)", "59.7", "47.6 - 74.9", "A: Drug X", "Change from Baseline", - "(N=134)", "", "0", "NA (NA)", "NA", "NA - NA", "", "134", "0.0 (0.0)", + "(N=134)", "", "0", "NA", "NA", "NA", "", "134", "0.0 (0.0)", "0.0", "0.0 - 0.0", "", "134", "1.7 (10.8)", "0.6", "-20.4 - 29.9", "", "134", "2.2 (11.8)", "3.1", "-23.9 - 39.2", "", "134", "2.1 (10.9)", "2.6", "-25.8 - 30.7", "", "134", "1.5 (10.9)", "1.2", "-30.9 - 24.8", @@ -101,7 +101,7 @@ testthat::test_that("VST01 default variant is produced correctly", { "47.7", "30.4 - 70.6", "", "134", "48.4 (8.0)", "47.7", "30.4 - 70.6", "", "134", "40.3 (5.3)", "40.3", "24.5 - 55.4", "", "134", "58.5 (4.8)", "58.3", "47.8 - 70.6", "B: Placebo", "Change from Baseline", - "(N=134)", "", "0", "NA (NA)", "NA", "NA - NA", "", "134", "0.0 (0.0)", + "(N=134)", "", "0", "NA", "NA", "NA", "", "134", "0.0 (0.0)", "0.0", "0.0 - 0.0", "", "134", "-0.8 (10.9)", "-1.1", "-25.8 - 28.4", "", "134", "-0.7 (12.4)", "-0.7", "-28.4 - 37.0", "", "134", "-1.3 (11.1)", "-2.3", "-28.1 - 33.9", "", "134", "-0.8 (10.6)", "-0.8", "-33.2 - 35.9", @@ -116,7 +116,7 @@ testthat::test_that("VST01 default variant is produced correctly", { "49.2", "30.6 - 72.9", "", "132", "49.1 (7.6)", "49.2", "30.6 - 72.9", "", "132", "40.5 (5.3)", "40.5", "24.8 - 54.9", "", "132", "58.6 (4.8)", "59.0", "41.8 - 72.9", "C: Combination", "Change from Baseline", - "(N=132)", "", "0", "NA (NA)", "NA", "NA - NA", "", "132", "0.0 (0.0)", + "(N=132)", "", "0", "NA", "NA", "NA", "", "132", "0.0 (0.0)", "0.0", "0.0 - 0.0", "", "132", "-2.3 (10.4)", "-2.2", "-22.1 - 22.4", "", "132", "-1.1 (11.6)", "-2.3", "-29.2 - 30.7", "", "132", "-1.2 (10.9)", "-0.6", "-29.7 - 27.0", "", "132", "-1.4 (11.0)", From 7fd9e8f14ca2b63a9a2f3e02491ec6700238be17 Mon Sep 17 00:00:00 2001 From: Melkiades Date: Thu, 25 Aug 2022 14:44:27 +0200 Subject: [PATCH 2/9] add NEWS --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index a0c02e02c8..c14bf832ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -37,6 +37,7 @@ * Renamed `test-assertthat.R` to `test-utils_checkmate.R`. ### Bug Fixes +* 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). * Fixed error coming from comparing factors vector to characters vector. From 87a2aad149f39e323921834a7b5bfbebb378c9b1 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 25 Aug 2022 12:48:41 +0000 Subject: [PATCH 3/9] [skip actions] Restyle files --- tests/testthat/test-response_subgroups.R | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testthat/test-response_subgroups.R b/tests/testthat/test-response_subgroups.R index 9395a57872..34b6fd7638 100644 --- a/tests/testthat/test-response_subgroups.R +++ b/tests/testthat/test-response_subgroups.R @@ -401,4 +401,3 @@ testthat::test_that("d_rsp_subgroups_colvars functions as expected with valid in testthat::expect_equal(result, expected) }) - From 5d52d887c4cc768a1aa678dea0d451a6994777af Mon Sep 17 00:00:00 2001 From: Davide Garolini Date: Thu, 25 Aug 2022 16:50:21 +0200 Subject: [PATCH 4/9] phantom changes for rebooting checks --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c14bf832ad..6f8eddf2e6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -37,7 +37,7 @@ * Renamed `test-assertthat.R` to `test-utils_checkmate.R`. ### Bug Fixes -* Fixed tests to respect the new standard print for `NA`. +* 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). * Fixed error coming from comparing factors vector to characters vector. From ca85e531a11edfeec793cd627557499bd488a9ae Mon Sep 17 00:00:00 2001 From: Melkiades Date: Fri, 26 Aug 2022 10:59:58 +0200 Subject: [PATCH 5/9] Fixing typo in stats::ancova (possible update of stats) --- R/coxph.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/coxph.R b/R/coxph.R index 4a452bd767..1706833ece 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, "P(>|Chi|)"] + stats::anova(without_interaction$mod, with_interaction$mod)[2, "Pr(>|Chi|)"] }, without_interaction = fit[2:(length(covariates) + 1)], with_interaction = fit[-(1:(length(covariates) + 1))] # nolint From 65013aa975bce1a73b56b050e10975c49f036d7a Mon Sep 17 00:00:00 2001 From: Melkiades Date: Fri, 26 Aug 2022 11:00:29 +0200 Subject: [PATCH 6/9] fixing class statement for expected (possible update of stats) --- tests/testthat/test-summarize_ancova.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-summarize_ancova.R b/tests/testthat/test-summarize_ancova.R index a4f719cc1b..b2564eb013 100644 --- a/tests/testthat/test-summarize_ancova.R +++ b/tests/testthat/test-summarize_ancova.R @@ -17,6 +17,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"), estName = "emmean", clNames = c("lower.CL", "upper.CL"), pri.vars = "Species", From a1e75edaf3cb6c3f19a190ae7edbf9170487e23d Mon Sep 17 00:00:00 2001 From: Melkiades Date: Fri, 26 Aug 2022 11:01:40 +0200 Subject: [PATCH 7/9] news update --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index c14bf832ad..82553115ff 100644 --- a/NEWS.md +++ b/NEWS.md @@ -37,6 +37,7 @@ * 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 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). From f064ceb4abc9a721a11e0c861b7348956c413016 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 26 Aug 2022 09:07:14 +0000 Subject: [PATCH 8/9] [skip actions] Restyle files --- tests/testthat/test-response_subgroups.R | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testthat/test-response_subgroups.R b/tests/testthat/test-response_subgroups.R index 9395a57872..34b6fd7638 100644 --- a/tests/testthat/test-response_subgroups.R +++ b/tests/testthat/test-response_subgroups.R @@ -401,4 +401,3 @@ testthat::test_that("d_rsp_subgroups_colvars functions as expected with valid in testthat::expect_equal(result, expected) }) - From 32aaff600f7197f34b35d1dc11b09f32dbffb94e Mon Sep 17 00:00:00 2001 From: Davide Garolini Date: Fri, 26 Aug 2022 11:07:56 +0200 Subject: [PATCH 9/9] phantom changes --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 82553115ff..494ced307b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,7 +14,7 @@ and related functions. ### Migration from `assertthat` to `checkmate` -* Substituted all `assertthat` calls with `checkmate`. +* Substituted all `assertthat` calls with `checkmate`. * Implemented `checkmate::assert_vector()`, `checkmate::assert_set_equal()`, and `checkmate::assert_int()` to validate vector type, length, and input. * Made `assert_df_with_factors` and `assert_proportion_value` internal functions.