Skip to content

Commit 556d78e

Browse files
committed
update tests
1 parent f4f149b commit 556d78e

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

tests/testthat/test_surv_reg.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ source("helpers.R")
1111
# ------------------------------------------------------------------------------
1212

1313
test_that('primary arguments', {
14+
withr::local_options(lifecycle_verbosity = "quiet")
15+
1416
basic <- surv_reg()
1517
basic_flexsurv <- translate(basic %>% set_engine("flexsurv"))
1618

@@ -46,6 +48,8 @@ test_that('primary arguments', {
4648
})
4749

4850
test_that('engine arguments', {
51+
withr::local_options(lifecycle_verbosity = "quiet")
52+
4953
fs_cl <- surv_reg()
5054
expect_equal(translate(fs_cl %>% set_engine("flexsurv", cl = .99))$method$fit$args,
5155
list(
@@ -60,6 +64,8 @@ test_that('engine arguments', {
6064

6165

6266
test_that('updating', {
67+
withr::local_options(lifecycle_verbosity = "quiet")
68+
6369
expr1 <- surv_reg() %>% set_engine("flexsurv", cl = varying())
6470
expr1_exp <- surv_reg(dist = "lnorm") %>% set_engine("flexsurv", cl = .99)
6571
expect_equal(update(expr1, dist = "lnorm", cl = 0.99), expr1_exp)
@@ -75,7 +81,14 @@ test_that('updating', {
7581
})
7682

7783
test_that('bad input', {
84+
withr::local_options(lifecycle_verbosity = "quiet")
85+
7886
expect_error(surv_reg(mode = ", classification"))
7987
expect_error(translate(surv_reg() %>% set_engine("wat")))
8088
expect_error(translate(surv_reg() %>% set_engine(NULL)))
8189
})
90+
91+
test_that("deprecation warning", {
92+
withr::local_options(lifecycle_verbosity = "warning")
93+
expect_warning(surv_reg())
94+
})

tests/testthat/test_surv_reg_flexsurv.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ library(tibble)
88

99
source(test_path("helper-objects.R"))
1010

11-
1211
basic_form <- Surv(time, status) ~ age
1312
complete_form <- Surv(time) ~ age
1413

15-
surv_basic <- surv_reg() %>% set_engine("flexsurv")
16-
1714
# ------------------------------------------------------------------------------
1815

1916
test_that('flexsurv execution', {
2017
skip_if_not_installed("flexsurv")
2118

19+
withr::local_options(lifecycle_verbosity = "quiet")
20+
surv_basic <- surv_reg() %>% set_engine("flexsurv")
21+
2222
expect_error(
2323
res <- fit(
2424
surv_basic,
@@ -53,6 +53,9 @@ test_that('flexsurv execution', {
5353
test_that('flexsurv prediction', {
5454
skip_if_not_installed("flexsurv")
5555

56+
withr::local_options(lifecycle_verbosity = "quiet")
57+
surv_basic <- surv_reg() %>% set_engine("flexsurv")
58+
5659
res <- fit(
5760
surv_basic,
5861
Surv(time, status) ~ age,

tests/testthat/test_surv_reg_survreg.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ source(test_path("helper-objects.R"))
1010
basic_form <- Surv(time, status) ~ group
1111
complete_form <- Surv(time) ~ group
1212

13-
surv_basic <- surv_reg() %>% set_engine("survival")
14-
surv_lnorm <- surv_reg(dist = "lognormal") %>% set_engine("survival")
15-
1613
# ------------------------------------------------------------------------------
1714

1815
test_that('survival execution', {
19-
2016
skip_on_travis()
2117

18+
withr::local_options(lifecycle_verbosity = "quiet")
19+
surv_basic <- surv_reg() %>% set_engine("survival")
20+
surv_lnorm <- surv_reg(dist = "lognormal") %>% set_engine("survival")
21+
2222
expect_error(
2323
res <- fit(
2424
surv_basic,
@@ -51,6 +51,10 @@ test_that('survival execution', {
5151
test_that('survival prediction', {
5252
skip_on_travis()
5353

54+
withr::local_options(lifecycle_verbosity = "quiet")
55+
surv_basic <- surv_reg() %>% set_engine("survival")
56+
surv_lnorm <- surv_reg(dist = "lognormal") %>% set_engine("survival")
57+
5458
res <- fit(
5559
surv_basic,
5660
Surv(time, status) ~ age + sex,

0 commit comments

Comments
 (0)