Skip to content

Commit

Permalink
Merge pull request #862 from MichaelChirico/patch-1
Browse files Browse the repository at this point in the history
More robust message wording test
  • Loading branch information
nikosbosse authored Jul 20, 2024
2 parents 1c21a39 + 847141f commit 396bd4d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ Authors@R: c(
comment = c(ORCID = "0000-0001-5782-7330")),
person("Sebastian", "Funk",
email = "[email protected]",
role = c("aut")))
role = c("aut")),
person(given = "Michael",
family = "Chirico",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-0787-087X")))
Description:
`scoringutils` facilitates the evaluation of forecasts in a convenient
framework based on `data.table`. It allows user to to check their forecasts
Expand Down
14 changes: 12 additions & 2 deletions tests/testthat/test-utils_data_handling.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ test_that("quantile_to_interval_dataframe() works", {
quantile[c(1, 3, 11, 13), c("observed", "predicted", "quantile_level") := NA]
# in this instance, a problem appears because there is an NA value both
# for the upper and lower bound.
expect_message(

# the data.table behavior differs before/after v1.16.0
# - before, it's a 'message'
# - after, it's a 'warning'
# - the conditionMessage() also differs
expected_condition <- tryCatch(
dcast(data.table(a = c(1, 1), b = 2, c = 3), a ~ b, value.var="c"),
condition = identity
)
expect_condition(
quantile_to_interval(
quantile,
keep_quantile_col = FALSE,
format = "wide"
),
"Aggregate function missing, defaulting to 'length'"
class = class(expected_condition)[1L], # testthat 3e requires exactly one class
regexp = "[Aa]ggregate.*default.*length"
)
quantile <- quantile[-c(1, 3), ]
wide2 <- scoringutils:::quantile_to_interval(
Expand Down

0 comments on commit 396bd4d

Please sign in to comment.