Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Dec 1, 2022
1 parent 3f89891 commit 280cfea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/testthat/test-summarise_draws.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("summarise_draws works correctly", {
expect_true(all(default_convergence_measures() %in% names(sum_x)))
expect_true(all(c("q5", "q95") %in% names(sum_x)))
expect_equal(sum_x$variable, variables(x))
expect_equal(mean(x$mu), sum_x$mean[sum_x$variable == "mu"])
expect_equal(mean(x$mu), as.numeric(sum_x$mean[sum_x$variable == "mu"]))

sum_x <- summarise_draws(x, mean, median)
expect_true(all(c("mean", "median") %in% names(sum_x)))
Expand Down Expand Up @@ -150,10 +150,12 @@ test_that("summarise_draws works with variance()", {

ref <- data.frame(
variable = variables(draws_array),
variance = as.vector(apply(draws_array, 3, function(x) var(as.vector(x)))),
variance = tibble::num(as.vector(
apply(draws_array, 3, function(x) var(as.vector(x)))
)),
stringsAsFactors = FALSE
)
class(ref) <- class_draws_summary()
class(ref) <- posterior:::class_draws_summary()

expect_equal(summarise_draws(draws_array, variance), ref)
expect_equal(summarise_draws(draws_matrix, variance), ref)
Expand Down

0 comments on commit 280cfea

Please sign in to comment.