From da3ec28867dd618e2286a67eee49f719b51f81b7 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 16 Jul 2024 15:06:17 -0700 Subject: [PATCH 1/4] More robust message wording test --- tests/testthat/test-utils_data_handling.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-utils_data_handling.R b/tests/testthat/test-utils_data_handling.R index b07d7e36a..55111dffa 100644 --- a/tests/testthat/test-utils_data_handling.R +++ b/tests/testthat/test-utils_data_handling.R @@ -29,13 +29,14 @@ 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( quantile_to_interval( quantile, keep_quantile_col = FALSE, format = "wide" ), - "Aggregate function missing, defaulting to 'length'" + "[Aa]ggregate.*default.*length" # the exact message differs for data.table before/after v1.16.0 ) quantile <- quantile[-c(1, 3), ] wide2 <- scoringutils:::quantile_to_interval( From 0308fdb32ecddab487da354c027adc7583ae8366 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 16 Jul 2024 16:32:38 -0700 Subject: [PATCH 2/4] it's also a warning now --- tests/testthat/test-utils_data_handling.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-utils_data_handling.R b/tests/testthat/test-utils_data_handling.R index 55111dffa..92af88321 100644 --- a/tests/testthat/test-utils_data_handling.R +++ b/tests/testthat/test-utils_data_handling.R @@ -30,7 +30,7 @@ test_that("quantile_to_interval_dataframe() works", { # in this instance, a problem appears because there is an NA value both # for the upper and lower bound. - expect_message( + expect_warning( quantile_to_interval( quantile, keep_quantile_col = FALSE, From 4d6f4ed9cf8fd67e111f7bc3161d6d06fe33dcc8 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 18 Jul 2024 09:52:51 -0700 Subject: [PATCH 3/4] More robust to warning/message --- tests/testthat/test-utils_data_handling.R | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-utils_data_handling.R b/tests/testthat/test-utils_data_handling.R index 92af88321..f46669142 100644 --- a/tests/testthat/test-utils_data_handling.R +++ b/tests/testthat/test-utils_data_handling.R @@ -29,14 +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_warning( + + # 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" ), - "[Aa]ggregate.*default.*length" # the exact message differs for data.table before/after v1.16.0 + 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( From ae5ad0cf5635497fbc0cc69717841c6064307a53 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 18 Jul 2024 09:57:42 -0700 Subject: [PATCH 4/4] Add as 'ctb' --- DESCRIPTION | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 54e914413..2d52cf2a8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,7 +32,12 @@ Authors@R: c( comment = c(ORCID = "0000-0001-5782-7330")), person("Sebastian", "Funk", email = "sebastian.funk@lshtm.ac.uk", - role = c("aut"))) + role = c("aut")), + person(given = "Michael", + family = "Chirico", + role = c("ctb"), + email = "michaelchirico4@gmail.com", + 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