mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 07:51:57 +02:00
(v1.5.0.9009) unit test fixes
This commit is contained in:
@ -479,10 +479,13 @@ format_class <- function(class, plural) {
|
||||
if ("matrix" %in% class) {
|
||||
class <- "a matrix"
|
||||
}
|
||||
if (any(c("mo", "ab", "rsi", "disk", "mic") %in% class)) {
|
||||
class <- paste0("a class <", class[1L], ">")
|
||||
if ("isolate_identifier" %in% class) {
|
||||
class <- "created with isolate_identifier()"
|
||||
}
|
||||
class[class == class.bak] <- paste0("a class <", class[class == class.bak], ">")
|
||||
if (any(c("mo", "ab", "rsi", "disk", "mic") %in% class)) {
|
||||
class <- paste0("of class <", class[1L], ">")
|
||||
}
|
||||
class[class == class.bak] <- paste0("of class <", class[class == class.bak], ">")
|
||||
# output
|
||||
vector_or(class, quotes = FALSE)
|
||||
}
|
||||
@ -514,7 +517,7 @@ meet_criteria <- function(object,
|
||||
if (!is.null(allow_class)) {
|
||||
stop_ifnot(inherits(object, allow_class), "argument `", obj_name,
|
||||
"` must be ", format_class(allow_class, plural = isTRUE(has_length > 1)),
|
||||
", not ", format_class(class(object), plural = isTRUE(has_length > 1)),
|
||||
", i.e. not be ", format_class(class(object), plural = isTRUE(has_length > 1)),
|
||||
call = call_depth)
|
||||
# check data.frames for data
|
||||
if (inherits(object, "data.frame")) {
|
||||
|
@ -83,9 +83,15 @@ isolate_identifier <- function(x, col_mo = NULL, cols_ab = NULL) {
|
||||
}
|
||||
|
||||
#' @method all.equal isolate_identifier
|
||||
#' @inheritParams base::all.equal
|
||||
#' @param ignore_empty_results a logical to indicate whether empty results must be ignored, so that only values R, S and I will be compared
|
||||
#' @rdname isolate_identifier
|
||||
#' @export
|
||||
all.equal.isolate_identifier <- function(target, current, ignore_empty_results = TRUE, ...) {
|
||||
meet_criteria(target, allow_class = "isolate_identifier")
|
||||
meet_criteria(current, allow_class = "isolate_identifier")
|
||||
meet_criteria(ignore_empty_results, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (isTRUE(all.equal.character(target, current))) {
|
||||
return(TRUE)
|
||||
}
|
||||
|
Reference in New Issue
Block a user