Skip to content

Commit

Permalink
Test that simple_ensemble() accepts custom functions without error
Browse files Browse the repository at this point in the history
Addresses #134 (`all.equal` sometimes threw an error)
  • Loading branch information
lshandross committed Sep 27, 2024
1 parent 2c04e6f commit f0c5825
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/testthat/test-simple_ensemble.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,17 @@ test_that("duplicate forecast values still result in correct weighted median", {

expect_equal(weighted_median_expected, weighted_median_actual)
})

test_that("simple_ensemble accepts custom functions without error", {
geometric_mean <- function(x) {
n <- length(x)
return(prod(x)^(1 / n))
}

model_outputs |>
hubEnsembles::simple_ensemble(
agg_fun = geometric_mean,
model_id = "simple-ensemble-geometric"
) |>
expect_no_error()
})

0 comments on commit f0c5825

Please sign in to comment.