Skip to content

Commit

Permalink
Update test-ard_survival_survfit_diff.R
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed May 24, 2024
1 parent 9afaea8 commit 181123e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-ard_survival_survfit_diff.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("ard_survival_survfit_diff() works", {
withr::local_package("survival")
sf <- survfit(Surv(AVAL, 1- CNSR) ~ SEX, cards::ADTTE)
sf <- survfit(Surv(AVAL, 1 - CNSR) ~ SEX, cards::ADTTE)
expect_silent(
ard1 <- ard_survival_survfit_diff(sf, times = c(25, 50))
)
Expand Down Expand Up @@ -37,15 +37,15 @@ test_that("ard_survival_survfit_diff() messaging", {
# we can only do one stratifying variable at a time
expect_snapshot(
error = TRUE,
survfit(Surv(AVAL, 1- CNSR) ~ SEX + TRTA, cards::ADTTE) |>
survfit(Surv(AVAL, 1 - CNSR) ~ SEX + TRTA, cards::ADTTE) |>
ard_survival_survfit_diff(times = c(25, 50))
)

# the stratifying variable must have 2 or more levels
expect_snapshot(
error = TRUE,
survfit(
Surv(AVAL, 1- CNSR) ~ constant,
Surv(AVAL, 1 - CNSR) ~ constant,
cards::ADTTE |> dplyr::mutate(constant = 1L)
) |>
ard_survival_survfit_diff(times = c(25, 50))
Expand Down

0 comments on commit 181123e

Please sign in to comment.