diff --git a/tests/testthat/_snaps/assertions.md b/tests/testthat/_snaps/assertions.md index 421705fb..63fb88e1 100644 --- a/tests/testthat/_snaps/assertions.md +++ b/tests/testthat/_snaps/assertions.md @@ -38,7 +38,7 @@ Error in `example_fun()`: ! Required variables `STUDYID` and `USUBJID` are missing in `dataset` -# assert_character_scalar Test 13: error if `arg` not in values +# assert_character_scalar Test 15: error if `arg` not in values Code check_unit("month") @@ -54,7 +54,7 @@ Error in `check_unit2()`: ! Argument `duration_unit` must be equal to one of "YEARS", "MONTHS", "WEEKS", "DAYS", "HOURS", "MINUTES", or "SECONDS". -# assert_character_scalar Test 14: error if not character +# assert_character_scalar Test 16: error if not character Code example_fun2(2) @@ -62,7 +62,7 @@ Error in `example_fun2()`: ! Argument `msg_type` must be a scalar of class , but is a number. -# assert_character_scalar Test 15: error if input is a vector +# assert_character_scalar Test 17: error if input is a vector Code example_fun2(c("admiral", "admiralonco")) @@ -70,7 +70,7 @@ Error in `example_fun2()`: ! Argument `msg_type` must be a scalar of class , but is length 2 -# assert_character_vector Test 16: error if `arg` not a character vector +# assert_character_vector Test 18: error if `arg` not a character vector Code assert_character_vector(arg) @@ -78,7 +78,7 @@ Error: ! Argument `arg` must be , but is a double vector. -# assert_character_vector Test 17: error if `arg` is not in values +# assert_character_vector Test 19: error if `arg` is not in values Code example_fun(character = c("oak", "mint")) @@ -86,7 +86,7 @@ Error in `example_fun()`: ! Argument `character` must be with values "test" and "oak". -# assert_character_vector Test 18: arg_name correctly displayed in name check +# assert_character_vector Test 20: arg_name correctly displayed in name check Code example_fun(character = c(tree = "oak", "test")) @@ -95,7 +95,7 @@ ! All elements of `character` argument must be named. i The indices of the unnamed elements are 2 -# assert_logical_scalar Test 20: error if `arg` is not TRUE or FALSE +# assert_logical_scalar Test 22: error if `arg` is not TRUE or FALSE Code example_fun("test") @@ -103,7 +103,7 @@ Error in `example_fun()`: ! Argument `arg` must be either TRUE or FALSE, but is a string. -# assert_symbol Test 22: `assert_symbol` throws an error if `arg` is missing +# assert_symbol Test 24: `assert_symbol` throws an error if `arg` is missing Code example_fun(f()) @@ -111,7 +111,7 @@ Error in `example_fun()`: ! Argument `arg` must be a , but is missing. -# assert_symbol Test 23: `assert_symbol` throws an error if `arg` is not a symbol +# assert_symbol Test 25: `assert_symbol` throws an error if `arg` is not a symbol Code example_fun(f(NULL)) @@ -119,7 +119,7 @@ Error in `example_fun()`: ! Argument `arg` must be a , but is NULL. -# assert_expr Test 27: `assert_expr` throws an error if `arg` is missing +# assert_expr Test 29: `assert_expr` throws an error if `arg` is missing Code assert_expr() @@ -135,7 +135,7 @@ Error in `example_fun()`: ! Argument `data` cannot be missing. -# assert_expr Test 28: `assert_expr` throws an error if `arg` is not an expression +# assert_expr Test 30: `assert_expr` throws an error if `arg` is not an expression Code var <- c(1, 2) @@ -144,7 +144,7 @@ Error: ! Argument `var` must be an expression, but is a double vector -# assert_vars Test 30: error if unexpected input +# assert_vars Test 32: error if unexpected input Code assert_vars(AVAL + 1) @@ -187,7 +187,7 @@ ! All elements of `exprs(APERSDT = APxxSDT, APxxEDT)` argument must be named. i The indices of the unnamed elements are 2 -# assert_vars Test 31: error if some elements of `arg` are not unquoted variable names +# assert_vars Test 33: error if some elements of `arg` are not unquoted variable names Code example_fun(exprs(USUBJID, PARAMCD, NULL)) @@ -196,7 +196,7 @@ ! Each element of the list in argument `arg` must be class/type . i But, element 3 is NULL -# assert_integer_scalar Test 33: error if chosen subset not in subsets +# assert_integer_scalar Test 35: error if chosen subset not in subsets Code example_fun(1) @@ -204,7 +204,7 @@ Error in `assert_integer_scalar()`: ! Argument `subset` must be equal to one of "positive", "non-negative", "negative", or "none". -# assert_integer_scalar Test 35: error if `arg` is not an integer scalar +# assert_integer_scalar Test 37: error if `arg` is not an integer scalar Code example_fun(1.5) @@ -212,7 +212,7 @@ Error in `example_fun()`: ! Argument `arg` must be an integer scalar. -# assert_numeric_vector Test 37: error if `arg` is not a numeric vector +# assert_numeric_vector Test 39: error if `arg` is not a numeric vector Code example_fun(TRUE) @@ -236,7 +236,7 @@ Error in `example_fun()`: ! Argument `arg` must be a numeric vector, but it is a string. -# assert_s3_class Test 38: error if `arg` is not an object of a specific class S3 +# assert_s3_class Test 40: error if `arg` is not an object of a specific class S3 Code example_fun("test") @@ -244,7 +244,7 @@ Error in `example_fun()`: ! Argument `arg` must be class , but is a string. -# assert_s3_class Test 40: error if `arg` is NULL and optional is FALSE +# assert_s3_class Test 42: error if `arg` is NULL and optional is FALSE Code example_fun(NULL) @@ -252,7 +252,7 @@ Error in `example_fun()`: ! Argument `arg` must be class , but is NULL. -# assert_list_of Test 42: error if `arg` is not a list of specific class S3 objects +# assert_list_of Test 44: error if `arg` is not a list of specific class S3 objects Code example_fun(list("test")) @@ -261,7 +261,7 @@ ! Each element of the list in argument `arg` must be class/type . i But, element 1 is a string -# assert_list_of Test 44: error if `arg` is NULL and optional is FALSE +# assert_list_of Test 46: error if `arg` is NULL and optional is FALSE Code example_fun(NULL) @@ -269,7 +269,7 @@ Error in `example_fun()`: ! Argument `arg` must be class , but is NULL. -# assert_list_of Test 46: error if `arg` is not a named list (no elements named) +# assert_list_of Test 48: error if `arg` is not a named list (no elements named) Code mylist <- list(1, 2, 3) @@ -279,7 +279,7 @@ ! All elements of `mylist` argument must be named. i The indices of the unnamed elements are 1, 2, and 3 -# assert_list_of Test 47: error if `arg` is not a named list (some elements named) +# assert_list_of Test 49: error if `arg` is not a named list (some elements named) Code mylist <- list(1, 2, 3, d = 4) @@ -289,7 +289,7 @@ ! All elements of `mylist` argument must be named. i The indices of the unnamed elements are 1, 2, and 3 -# assert_named Test 50: error if no elements are named +# assert_named Test 52: error if no elements are named Code arg <- c(1, 2) @@ -299,7 +299,7 @@ ! All elements of `arg` argument must be named. i The indices of the unnamed elements are 1 and 2 -# assert_function Test 54: error if `arg` is not a function +# assert_function Test 56: error if `arg` is not a function Code example_fun(5) @@ -307,7 +307,7 @@ Error in `example_fun()`: ! Argument `arg` must be a function, but is a number. -# assert_function Test 57: error if `params` is missing with no default +# assert_function Test 59: error if `params` is missing with no default Code example_fun(sum) @@ -323,7 +323,7 @@ Error in `example_fun()`: ! "x" and "y" are not arguments of the function specified for `arg`. -# assert_unit Test 62: error if there are multiple units in the input dataset +# assert_unit Test 64: error if there are multiple units in the input dataset Code assert_unit(advs, param = "WEIGHT", required_unit = "kg", get_unit_expr = VSSTRESU) @@ -331,7 +331,7 @@ Error: ! Multiple units "kg" and "lb" found for "WEIGHT". Please review and update the units. -# assert_unit Test 63: error if unexpected unit in the input dataset +# assert_unit Test 65: error if unexpected unit in the input dataset Code assert_unit(advs, param = "WEIGHT", required_unit = "lb", get_unit_expr = VSSTRESU) @@ -339,7 +339,7 @@ Error: ! It is expected that "WEIGHT" has unit of "lb". In the input dataset the unit is "kg". -# assert_param_does_not_exist Test 64: error if parameter exists in the input dataset +# assert_param_does_not_exist Test 66: error if parameter exists in the input dataset Code assert_param_does_not_exist(advs, param = "WEIGHT") @@ -347,7 +347,7 @@ Error: ! The parameter code "WEIGHT" already exists in dataset `advs`. -# assert_varval_list Test 66: error if `arg` is not a list of var-value expressions +# assert_varval_list Test 68: error if `arg` is not a list of var-value expressions Code example_fun(c("USUBJID", "PARAMCD", "VISIT")) @@ -356,7 +356,7 @@ ! Argument `arg` must be a named list of expressions where each element is a symbol, character scalar, numeric scalar, an expression, or NA, but is a character vector. i To create a list of expressions use `exprs()`. -# assert_varval_list Test 67: error if `arg` is not a list of var-value expressions +# assert_varval_list Test 69: error if `arg` is not a list of var-value expressions Code example_fun(exprs(USUBJID, PARAMCD, NULL)) @@ -365,7 +365,7 @@ ! Argument `arg` must be a list of expressions where each element is a symbol, character scalar, numeric scalar, an expression, or NA, but is a list. i To create a list of expressions use `exprs()`. -# assert_varval_list Test 68: error if `required_elements` are missing from `arg` +# assert_varval_list Test 70: error if `required_elements` are missing from `arg` Code example_fun(exprs(DTHSEQ = AESEQ)) @@ -373,7 +373,7 @@ Error in `example_fun()`: ! The following required elements are missing from argument `arg`: "DTHDOM". -# assert_varval_list Test 70: error if `accept_expr` is TRUE and value is invalid +# assert_varval_list Test 72: error if `accept_expr` is TRUE and value is invalid Code example_fun(exprs(DTHSEQ = TRUE)) @@ -382,7 +382,7 @@ ! The elements of the list in argument `arg` must be a symbol, character scalar, numeric scalar, an expression, or NA. i "DTHSEQ" = `TRUE` is of type -# assert_varval_list Test 71: error if `accept_expr` is FALSE and value is invalid +# assert_varval_list Test 73: error if `accept_expr` is FALSE and value is invalid Code example_fun(exprs(DTHSEQ = exprs())) @@ -391,7 +391,7 @@ ! The elements of the list in argument `arg` must be a symbol, character scalar, numeric scalar, or NA. i "DTHSEQ" = `exprs()` is of type -# assert_list_element Test 80: error if the elements do not fulfill the condition +# assert_list_element Test 82: error if the elements do not fulfill the condition Code assert_list_element(list(list(var = expr(DTHDT), val = 1), list(var = expr( @@ -403,7 +403,7 @@ ! List element "val" must be `>=0` in argument `input`: i But, `input[[2]]$val = -1`, and `input[[3]]$val = -2` -# assert_one_to_one Test 81: error if there is a one to many mapping +# assert_one_to_one Test 83: error if there is a one to many mapping Code assert_one_to_one(dm, exprs(DOMAIN), exprs(USUBJID)) @@ -412,7 +412,7 @@ ! For some values of "DOMAIN" there is more than one value of "USUBJID" i Call `get_one_to_many_dataset()` to get all one-to-many values. -# assert_date_var Test 84: error if variable is not a date or datetime variable +# assert_date_var Test 86: error if variable is not a date or datetime variable Code example_fun(dataset = my_data, var = USUBJID) @@ -420,7 +420,7 @@ Error in `example_fun()`: ! Column "USUBJID" in dataset `dataset` must be a date or datetime, but is a character vector. -# assert_date_vector Test 88: error if `arg` is NULL and optional is FALSE +# assert_date_vector Test 90: error if `arg` is NULL and optional is FALSE Code example_fun(NULL) @@ -428,7 +428,7 @@ Error in `example_fun()`: ! Argument `arg` must be a date or datetime, but is NULL. -# assert_atomic_vector Test 89: error if input is not atomic vector +# assert_atomic_vector Test 91: error if input is not atomic vector Code assert_atomic_vector(x) @@ -436,7 +436,7 @@ Error: ! Argument `x` must be an atomic vector, but is a list. -# assert_same_type Test 91: error if different type +# assert_same_type Test 93: error if different type Code assert_same_type(true_value, false_value, missing_value)