From 3f50d6b6c333c14598eb74132b1d0f49481f6cb2 Mon Sep 17 00:00:00 2001 From: Matthijs Berends Date: Fri, 4 Sep 2026 19:47:30 +0200 Subject: [PATCH] (v3.0.1.9090) unit test --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- R/aa_helper_functions.R | 12 ++++++++---- tests/testthat/test-interpretive_rules.R | 10 +++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5496f4875..a7c4d6f33 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/NEWS.md b/NEWS.md index 6cf79b6e0..578281a34 100644 --- a/NEWS.md +++ b/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. diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index e2fa96d98..8b55644a6 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -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", ""), diff --git a/tests/testthat/test-interpretive_rules.R b/tests/testthat/test-interpretive_rules.R index 4ffa19b62..2b9971bdf 100755 --- a/tests/testthat/test-interpretive_rules.R +++ b/tests/testthat/test-interpretive_rules.R @@ -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()