File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ test_that(" primary argument" , {
3+ new_empty_quosure <- function (expr ) {
4+ rlang :: new_quosure(expr , env = rlang :: empty_env())
5+ }
6+
7+ normal <- survival_reg(dist = " lnorm" )
8+ expect_equal(
9+ normal $ args ,
10+ list (dist = new_empty_quosure(" lnorm" ))
11+ )
12+
13+ dist_v <- survival_reg(dist = varying())
14+ expect_equal(
15+ dist_v $ args ,
16+ list (dist = new_empty_quosure(varying()))
17+ )
18+ })
19+
20+ test_that(" updating" , {
21+ new_empty_quosure <- function (expr ) {
22+ rlang :: new_quosure(expr , env = rlang :: empty_env())
23+ }
24+
25+ basic <- survival_reg()
26+
27+ update_chr <- update(basic , dist = " lnorm" )
28+ expect_equal(
29+ update_chr $ args ,
30+ list (dist = new_empty_quosure(" lnorm" ))
31+ )
32+
33+ param_tibb <- tibble :: tibble(dist = " weibull" )
34+ update_tibb <- update(basic , param_tibb )
35+ expect_equal(
36+ update_tibb $ args ,
37+ list (dist = " weibull" )
38+ )
39+
40+ param_list <- as.list(param_tibb )
41+ update_list <- update(basic , param_list )
42+ expect_equal(
43+ update_list $ args ,
44+ list (dist = " weibull" )
45+ )
46+
47+ })
48+
49+ test_that(" bad input" , {
50+ expect_error(survival_reg(mode = " , classification" ))
51+ })
52+
53+ test_that(" wrong fit interface" , {
54+ expect_error(
55+ survival_reg() %> % fit_xy(),
56+ " must use the formula interface"
57+ )
58+ })
You can’t perform that action at this time.
0 commit comments