(v1.5.0.9017) unit testing

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2021-02-08 21:09:36 +01:00
1 parent 4a84894f79
commit cb404492b2
20 files changed
+47 -36

No files matched your search

+1 -1
View File
@@ -734,7 +734,7 @@ get_current_column <- function() {
is_null_or_grouped_tbl <- function(x) {
# attribute "grouped_df" might change at one point, so only set in one place; here.
is.null(x) || inherits(x, "grouped_tbl")
is.null(x) || inherits(x, "grouped_df")
}
unique_call_id <- function(entire_session = FALSE) {
-3
View File
@@ -147,9 +147,6 @@ filter_ab_class <- function(x,
} else {
scope_txt <- " and "
scope_fn <- all
if (length(agents) > 1) {
operator <- gsub("is", "are", operator)
}
}
if (length(agents) > 1) {
operator <- " are"
+6 -3
View File
@@ -187,7 +187,8 @@ first_isolate <- function(x = NULL,
if (is_null_or_grouped_tbl(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- get_current_data(arg_name = "x", call = -2)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
meet_criteria(x, allow_class = "data.frame")
}
# remove data.table, grouping from tibbles, etc.
x <- as.data.frame(x, stringsAsFactors = FALSE)
@@ -518,7 +519,8 @@ filter_first_isolate <- function(x = NULL,
if (is_null_or_grouped_tbl(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- get_current_data(arg_name = "x", call = -2)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
meet_criteria(x, allow_class = "data.frame")
}
subset(x, first_isolate(x = x,
col_date = col_date,
@@ -543,7 +545,8 @@ filter_first_weighted_isolate <- function(x = NULL,
if (is_null_or_grouped_tbl(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- get_current_data(arg_name = "x", call = -2)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
meet_criteria(x, allow_class = "data.frame")
}
y <- x
if (is.null(col_keyantibiotics)) {
+2 -1
View File
@@ -155,7 +155,8 @@ key_antibiotics <- function(x = NULL,
if (is_null_or_grouped_tbl(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- get_current_data(arg_name = "x", call = -2)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
meet_criteria(x, allow_class = "data.frame")
}
# force regular data.frame, not a tibble or data.table
x <- as.data.frame(x, stringsAsFactors = FALSE)
+2 -1
View File
@@ -218,7 +218,8 @@ mdro <- function(x = NULL,
if (is_null_or_grouped_tbl(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- get_current_data(arg_name = "x", call = -2)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
meet_criteria(x, allow_class = "data.frame")
}
# force regular data.frame, not a tibble or data.table