Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

687 fix from formatters na str@main #690

Merged
merged 12 commits into from
Aug 26, 2022
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-response_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/test-summarize_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-survival_duration_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-table_egt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-table_lbt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-table_vst01.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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)",
Expand Down