Skip to content

Commit

Permalink
Disable GridPopulation with SurvivalQuantities (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc authored May 8, 2024
1 parent 4c63b98 commit 4aa31f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/SurvivalQuantities.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ SurvivalQuantities <- function(
type <- match.arg(type)
assert_class(object, "JointModelSamples")
assert_class(grid, "Grid")
assert_that(
!is(grid, "GridPopulation"),
msg = "GridPopulation objects are not supported for `SurvivalQuantities`"
)

time_grid <- seq(
from = 0,
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-Grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -696,3 +696,15 @@ test_that("GridPopulation() works as expected for Longitudinal models", {
expect_equal(actual$group, expected$group)

})

test_that("GridPopulation() doesn't work with SurvivalQuantities", {
expect_error(
SurvivalQuantities(
fixtures_gsf$mp,
grid = GridPopulation(
times = seq(1, 4, by = 0.02)
)
),
regex = "not supported"
)
})

0 comments on commit 4aa31f9

Please sign in to comment.