Skip to content

Commit

Permalink
fix test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed Oct 28, 2024
1 parent b370557 commit 095c424
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion tests/testthat/test-class-forecast-quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ test_that("score() works even if only some quantiles are missing", {

# asymmetric intervals
asymm <- example_quantile[!quantile_level > 0.6]
metrics <- get_metrics(example_quantile)
metrics <- get_metrics(
example_quantile,
exclude = c("overprediction", "underprediction", "dispersion")
)
metrics$wis <- purrr::partial(wis, na.rm = TRUE)
expect_warning(
expect_warning(
Expand Down
14 changes: 9 additions & 5 deletions tests/testthat/test-class-forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ test_that("print() works on forecast_* objects", {
test_that("print() throws the expected messages", {
test <- data.table::copy(example_point)
class(test) <- c("point", "forecast", "data.table", "data.frame")
suppressMessages(
expect_message(
capture.output(print(test)),
"Could not determine forecast type due to error in validation."
)
expect_warning(
suppressMessages(
expect_message(
capture.output(print(test)),
"Could not determine forecast type due to error in validation."
)
),
"Error in validating"
)

class(test) <- c("forecast_point", "forecast")
Expand Down Expand Up @@ -216,3 +219,4 @@ test_that("removing NA rows from data works as expected", {
attributes
)
})

0 comments on commit 095c424

Please sign in to comment.