Skip to content

Commit

Permalink
unit tests for tidymodels/parsnip#1024
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Nov 14, 2023
1 parent 77df962 commit 3db37ec
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test-survival-parsnip-graf-weights.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
test_that("no names in Graf weight values", {
skip_if_not_installed("parsnip", minimum_version = "1.1.1.9002")

# See tidymodels/parsnip#1023 tidymodels/parsnip#1024

surv_obj <-
structure(
c(9, 13, 13, 18, 23, 28, 1, 1, 0, 1, 1, 0),
dim = c(6L, 2L),
dimnames = list(NULL, c("time", "status")),
type = "right",
class = "Surv"
)

row_1 <- parsnip:::graf_weight_time_vec(surv_obj[1,,drop = FALSE], 1.0)
row_5 <- parsnip:::graf_weight_time_vec(surv_obj, 1.0)
expect_null(names(row_1))
expect_null(names(row_5))
})

0 comments on commit 3db37ec

Please sign in to comment.