Skip to content

Commit

Permalink
Update expected error and warning messages in unit-test now word argu…
Browse files Browse the repository at this point in the history
…ment has been replaced by parameter
  • Loading branch information
vincentvanhees committed Jan 22, 2025
1 parent 68c5863 commit c955b72
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/testthat/test_load_check_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ test_that("load_params can load parameters", {
expect_error(check_params(params_sleep), regexp = NA)
# Test that parameter check produces error when numeric is given a character value
params_sleep$timethreshold = "ABC"
expect_error(check_params(params_sleep), regexp = "Sleep argument timethreshold is not numeric")
expect_error(check_params(params_sleep), regexp = "Sleep parameter timethreshold is not numeric")
params_sleep = params$params_sleep
# Test that parameter check produces error when character is given a numeric value
params_sleep$Sadeh_axis = 123
expect_error(check_params(params_sleep), regexp = "Sleep argument Sadeh_axis is not character")
expect_error(check_params(params_sleep), regexp = "Sleep parameter Sadeh_axis is not character")
params_sleep = params$params_sleep
# Test that parameter check produces error when boolean is given a numeric value
params_general$overwrite = 123
expect_error(check_params(params_general = params_general), regexp = "general argument overwrite is not boolean")
expect_error(check_params(params_general = params_general), regexp = "general parameter overwrite is not boolean")
params_general = params$params_general

# Error if brondcounts calculated
Expand Down Expand Up @@ -79,7 +79,7 @@ test_that("load_params can load parameters", {
params_sleep$Sadeh_axis = "y"
expect_warning(check_params(params_metrics = params_metrics,
params_sleep = params_sleep),
regexp = "Argument Sadeh_axis does not have meaningful value")
regexp = "Parameter Sadeh_axis does not have meaningful value")
params_sleep$Sadeh_axis = "Y"
check = check_params(params_metrics = params_metrics,
params_sleep = params_sleep)
Expand Down Expand Up @@ -118,25 +118,25 @@ test_that("load_params can load parameters", {
params_cleaning$data_masking_strategy = 2
params_cleaning$hrs.del.start = 1
expect_warning(check_params(params_cleaning = params_cleaning),
regexp = "Setting argument hrs.del.start")
regexp = "Setting parameter hrs.del.start")
params_cleaning = params$params_cleaning
params_cleaning$data_masking_strategy = 2
params_cleaning$hrs.del.end = 1
expect_warning(check_params(params_cleaning = params_cleaning),
regexp = "Setting argument hrs.del.end")
regexp = "Setting parameter hrs.del.end")
params_cleaning = params$params_cleaning

# if data_masking_strategy != c(3,5), ndayswindow != 7 does not make sense
params_cleaning$ndayswindow = 14
expect_warning(check_params(params_cleaning = params_cleaning),
regexp = "Setting argument ndayswindow in combination")
regexp = "Setting parameter ndayswindow in combination")
params_cleaning = params$params_cleaning

# if data_masking_strategy == 5, ndayswindow should be integer
params_cleaning$data_masking_strategy = 5
params_cleaning$ndayswindow = 7.5
check = expect_warning(check_params(params_cleaning = params_cleaning),
regexp = "Argument ndayswindow has been rounded")
regexp = "Parameter ndayswindow has been rounded")
expect_equal(check$params_cleaning$ndayswindow, 8)
params_cleaning = params$params_cleaning

Expand All @@ -149,7 +149,7 @@ test_that("load_params can load parameters", {
# bout.metric should not be used anymore
params_phyact$bout.metric = 6
expect_warning(check_params(params_phyact = params_phyact),
regexp = "Arguments bout.metric and closedbout are no longer")
regexp = "Parameters bout.metric and closedbout are no longer")
params_phyact = params$params_phyact

# length of mvpadur should be 3
Expand Down Expand Up @@ -227,7 +227,7 @@ test_that("load_params can load parameters", {
# segmentDAYSPTcrit.part5 should be two numbers between 0 and 1
params_cleaning$segmentDAYSPTcrit.part5 = NULL
expect_error(check_params(params_cleaning = params_cleaning),
regexp = "Argument segmentDAYSPTcrit.part5 is expected to be a numeric vector of length 2")
regexp = "Parameter segmentDAYSPTcrit.part5 is expected to be a numeric vector of length 2")
params_cleaning$segmentDAYSPTcrit.part5 = c(-1, 0)
expect_error(check_params(params_cleaning = params_cleaning),
regexp = paste0("Incorrect values of segmentDAYSPTcrit.part5,",
Expand Down

0 comments on commit c955b72

Please sign in to comment.