Check the class membership of an argument
Usage
checkMultiClass(x, classes, null.ok = FALSE)
check_multi_class(x, classes, null.ok = FALSE)
assertMultiClass(x, classes, null.ok = FALSE, .var.name = vname(x), add = NULL)
assert_multi_class(
x,
classes,
null.ok = FALSE,
.var.name = vname(x),
add = NULL
)
testMultiClass(x, classes, null.ok = FALSE)
test_multi_class(x, classes, null.ok = FALSE)
expect_multi_class(x, classes, null.ok = FALSE, info = NULL, label = vname(x))Arguments
- x
[
any]
Object to check.- classes
[
character]
Class names to check for inheritance withinherits.xmust inherit from any of the specified classes.- null.ok
[
logical(1)]
If set toTRUE,xmay also beNULL. In this case only a type check ofxis performed, all additional checks are disabled.- .var.name
[
character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented invname.- add
[
AssertCollection]
Collection to store assertion messages. SeeAssertCollection.- info
[
character(1)]
Extra information to be included in the message for the testthat reporter. Seeexpect_that.- label
[
character(1)]
Name of the checked object to print in messages. Defaults to the heuristic implemented invname.
Value
Depending on the function prefix:
If the check is successful, the functions
assertMultiClass/assert_multi_class return
x invisibly, whereas
checkMultiClass/check_multi_class and
testMultiClass/test_multi_class return
TRUE.
If the check is not successful,
assertMultiClass/assert_multi_class
throws an error message,
testMultiClass/test_multi_class
returns FALSE,
and checkMultiClass/check_multi_class
return a string with the error message.
The function expect_multi_class always returns an
expectation.
See also
Other attributes:
checkClass(),
checkNamed(),
checkNames()
Other classes:
checkClass(),
checkR6()