1
0
mirror of https://github.com/msberends/AMR.git synced 2026-09-11 16:18:54 +02:00

(v3.0.1.9090) unit test

This commit is contained in:
2026-09-04 19:47:30 +02:00
parent 177e83aaf8
commit 3f50d6b6c3
4 changed files with 16 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 3.0.1.9089 Version: 3.0.1.9090
Date: 2026-09-03 Date: 2026-09-04
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@@ -1,4 +1,4 @@
# AMR 3.0.1.9089 # AMR 3.0.1.9090
Planned as v3.1.0, end of September 2026. Planned as v3.1.0, end of September 2026.

View File

@@ -972,10 +972,14 @@ meet_criteria <- function(object, # can be literally `list(...)` for `allow_argu
if ("logical" %in% allow_class) { if ("logical" %in% allow_class) {
or_values <- paste0(or_values, ", or TRUE or FALSE") or_values <- paste0(or_values, ", or TRUE or FALSE")
} }
stop_ifnot(all(object %in% is_in.bak, na.rm = TRUE), "argument {.arg ", obj_name, "} ", 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, ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
"must be either ", "must be either ",
"must only contain values " "must only contain values "
)
), ),
or_values, or_values,
ifelse(allow_NA == TRUE, ", or NA", ""), ifelse(allow_NA == TRUE, ", or NA", ""),

View File

@@ -108,17 +108,17 @@ test_that("test-interpretive_rules.R", {
) )
expect_equal(suppressWarnings(interpretive_rules(a, "mo", info = FALSE)), b) 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)) { if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
expect_equal( expect_equal(
suppressWarnings( suppressWarnings(
example_isolates %>% example_isolates %>%
filter(mo_family(mo) == "Enterobacteriaceae") %>% filter(mo_name(mo) == "Escherichia coli") %>%
mutate( mutate(
TIC = as.sir("R"), AMP = as.sir("R"),
PIP = as.sir("S") 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) %>% pull(PIP) %>%
unique() %>% unique() %>%
as.character() as.character()