mirror of
https://github.com/msberends/AMR.git
synced 2026-09-11 13:38:54 +02:00
(v3.0.1.9090) unit test
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 3.0.1.9089
|
||||
Date: 2026-09-03
|
||||
Version: 3.0.1.9090
|
||||
Date: 2026-09-04
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
data analysis and to work with microbial and antimicrobial properties by
|
||||
|
||||
2
NEWS.md
2
NEWS.md
@@ -1,4 +1,4 @@
|
||||
# AMR 3.0.1.9089
|
||||
# AMR 3.0.1.9090
|
||||
|
||||
Planned as v3.1.0, end of September 2026.
|
||||
|
||||
|
||||
@@ -972,10 +972,14 @@ meet_criteria <- function(object, # can be literally `list(...)` for `allow_argu
|
||||
if ("logical" %in% allow_class) {
|
||||
or_values <- paste0(or_values, ", or TRUE or FALSE")
|
||||
}
|
||||
stop_ifnot(all(object %in% is_in.bak, na.rm = TRUE), "argument {.arg ", obj_name, "} ",
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
|
||||
"must be either ",
|
||||
"must only contain values "
|
||||
stop_ifnot(all(object %in% is_in.bak, na.rm = TRUE),
|
||||
"argument {.arg ", obj_name, "} ",
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1 && length(is_in.bak) == 1,
|
||||
"must be ",
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
|
||||
"must be either ",
|
||||
"must only contain values "
|
||||
)
|
||||
),
|
||||
or_values,
|
||||
ifelse(allow_NA == TRUE, ", or NA", ""),
|
||||
|
||||
@@ -108,17 +108,17 @@ test_that("test-interpretive_rules.R", {
|
||||
)
|
||||
expect_equal(suppressWarnings(interpretive_rules(a, "mo", info = FALSE)), b)
|
||||
|
||||
# piperacillin must be R in Enterobacteriaceae when tica is R
|
||||
# piperacillin must be R in E. coli when ampi is R
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
|
||||
expect_equal(
|
||||
suppressWarnings(
|
||||
example_isolates %>%
|
||||
filter(mo_family(mo) == "Enterobacteriaceae") %>%
|
||||
filter(mo_name(mo) == "Escherichia coli") %>%
|
||||
mutate(
|
||||
TIC = as.sir("R"),
|
||||
PIP = as.sir("S")
|
||||
AMP = as.sir("R"),
|
||||
PIP = as.sir(NA)
|
||||
) %>%
|
||||
interpretive_rules(col_mo = "mo", version_expertrules = 3.1, rules = "expert", info = FALSE, overwrite = TRUE) %>%
|
||||
interpretive_rules(col_mo = "mo", version_expertrules = 3.3, rules = "expert", info = FALSE, overwrite = TRUE) %>%
|
||||
pull(PIP) %>%
|
||||
unique() %>%
|
||||
as.character()
|
||||
|
||||
Reference in New Issue
Block a user