From 7b62eb33b128c6640ffbe601d4b412bdf3225ead Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Wed, 28 Aug 2024 16:34:28 -0400 Subject: [PATCH] Fix tests --- _pkgdown.yml | 1 + tests/testthat/_snaps/boot_ci.md | 111 +++++++++++++++++++++++++------ tests/testthat/test-boot_ci.R | 7 +- 3 files changed, 93 insertions(+), 26 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index f48f87f6b..c4a764870 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -90,5 +90,6 @@ reference: - title: "Helpers" - contents: + - boot_ci - proportion_ci - construction_helpers diff --git a/tests/testthat/_snaps/boot_ci.md b/tests/testthat/_snaps/boot_ci.md index e6544886d..6aaca7897 100644 --- a/tests/testthat/_snaps/boot_ci.md +++ b/tests/testthat/_snaps/boot_ci.md @@ -29,28 +29,97 @@ Code res - Message - {cards} data frame: 16 x 8 Output - variable context stat_name stat_label stat warning - 1 AGE continuo… N N 254 bootstra… - 2 AGE continuo… estimate estimate 75.087 bootstra… - 3 AGE continuo… conf.level conf.lev… 0.95 bootstra… - 4 AGE continuo… R R 2000 bootstra… - 5 AGE continuo… ci.type.1 ci.type.1 normal bootstra… - 6 AGE continuo… conf.low.1 conf.low… 74.081 bootstra… - 7 AGE continuo… conf.high.1 conf.hig… 76.11 bootstra… - 8 AGE continuo… ci.type.2 ci.type.2 basic bootstra… - 9 AGE continuo… conf.low.2 conf.low… 74.114 bootstra… - 10 AGE continuo… conf.high.2 conf.hig… 76.153 bootstra… - 11 AGE continuo… ci.type.3 ci.type.3 percent bootstra… - 12 AGE continuo… conf.low.3 conf.low… 74.02 bootstra… - 13 AGE continuo… conf.high.3 conf.hig… 76.059 bootstra… - 14 AGE continuo… ci.type.4 ci.type.4 bca bootstra… - 15 AGE continuo… conf.low.4 conf.low… 73.992 bootstra… - 16 AGE continuo… conf.high.4 conf.hig… 76.04 bootstra… - Message - i 2 more variables: fmt_fn, error + $N + [1] 254 + + $estimate + [1] 75.08661 + + $conf.level + [1] 0.95 + + $R + [1] 2000 + + $ci.type.1 + [1] "normal" + + $conf.low.1 + [1] 74.08126 + + $conf.high.1 + [1] 76.11047 + + $ci.type.2 + [1] "basic" + + $conf.low.2 + [1] 74.11417 + + $conf.high.2 + [1] 76.15325 + + $ci.type.3 + [1] "percent" + + $conf.low.3 + [1] 74.01998 + + $conf.high.3 + [1] 76.05906 + + $ci.type.4 + [1] "bca" + + +--- + + Code + res + Output + $N + [1] 254 + + $estimate + [1] 75.08661 + + $conf.level + [1] 0.95 + + $R + [1] 2000 + + $ci.type.1 + [1] "normal" + + $conf.low.1 + [1] 74.08126 + + $conf.high.1 + [1] 76.11047 + + $ci.type.2 + [1] "basic" + + $conf.low.2 + [1] 74.11417 + + $conf.high.2 + [1] 76.15325 + + $ci.type.3 + [1] "percent" + + $conf.low.3 + [1] 74.01998 + + $conf.high.3 + [1] 76.05906 + + $ci.type.4 + [1] "bca" + # boot_ci() warnings work diff --git a/tests/testthat/test-boot_ci.R b/tests/testthat/test-boot_ci.R index 0ccbff96f..44614b01d 100644 --- a/tests/testthat/test-boot_ci.R +++ b/tests/testthat/test-boot_ci.R @@ -8,11 +8,8 @@ test_that("boot_ci() works with standard use", { expect_snapshot(res) set.seed(1) - res <- cards::ADSL |> - cards::ard_continuous( - variables = AGE, - statistic = everything() ~ list(boot_ci = boot_ci) - ) + expect_warning(res <- boot_ci(x, type = "all")[1:14]) + expect_snapshot(res) expect_snapshot(res) })