mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 01:22:25 +02:00
more unit tests
This commit is contained in:
@ -22,14 +22,11 @@ test_that("as.mo works", {
|
||||
expect_equal(as.character(as.mo("Bartonella")), "B_BRTNL")
|
||||
expect_equal(as.character(as.mo("C. difficile")), "B_CTRDM_DIF")
|
||||
expect_equal(as.character(as.mo("L. pneumophila")), "B_LGNLL_PNE")
|
||||
# expect_equal(as.character(as.mo("L. non pneumophila")), "LEGNON")
|
||||
# expect_equal(as.character(as.mo("S. beta-haemolytic")), "STCHAE")
|
||||
expect_equal(as.character(as.mo("Strepto")), "B_STRPTC")
|
||||
expect_equal(as.character(as.mo("Streptococcus")), "B_STRPTC") # not Peptostreptoccus
|
||||
|
||||
expect_equal(as.character(as.mo(c("GAS", "GBS"))), c("B_STRPTC_GRA", "B_STRPTC_GRB"))
|
||||
|
||||
|
||||
expect_equal(as.character(as.mo("S. pyo")), "B_STRPTC_PYO") # not Actinomyces pyogenes
|
||||
|
||||
expect_equal(as.character(as.mo("P. aer")), "B_PDMNS_AER") # not Pasteurella aerogenes
|
||||
@ -50,6 +47,9 @@ test_that("as.mo works", {
|
||||
expect_equal(as.character(as.mo("CPS")), "B_STPHY_CPS")
|
||||
expect_equal(as.character(as.mo("CoPS")), "B_STPHY_CPS")
|
||||
|
||||
expect_equal(as.character(as.mo(c("Gram negative", "Gram positive"))), c("B_GRAMN", "B_GRAMP"))
|
||||
|
||||
# prevalent MO
|
||||
expect_identical(
|
||||
as.character(
|
||||
as.mo(c("stau",
|
||||
@ -61,6 +61,21 @@ test_that("as.mo works", {
|
||||
"MRSA",
|
||||
"VISA"))),
|
||||
rep("B_STPHY_AUR", 8))
|
||||
# unprevalent MO
|
||||
expect_identical(
|
||||
as.character(
|
||||
as.mo(c("buno",
|
||||
"BUNO",
|
||||
"burnod",
|
||||
"B. nodosa",
|
||||
"B nodosa",
|
||||
"Burkholderia nodosa"))),
|
||||
rep("B_BRKHL_NOD", 6))
|
||||
|
||||
# empty values
|
||||
expect_identical(as.character(as.mo(c("", NA, NaN))), rep(NA_character_, 3))
|
||||
# too few characters
|
||||
expect_warning(as.mo("ab"))
|
||||
|
||||
# check for Becker classification
|
||||
expect_identical(as.character(guess_mo("S. epidermidis", Becker = FALSE)), "B_STPHY_EPI")
|
||||
@ -143,6 +158,7 @@ test_that("as.mo works", {
|
||||
|
||||
# check less prevalent MOs
|
||||
expect_equal(as.character(as.mo("Gomphosphaeria aponina delicatula")), "B_GMPHS_APO_DEL")
|
||||
expect_equal(as.character(as.mo("Gomphosphaeria apo del")), "B_GMPHS_APO_DEL")
|
||||
expect_equal(as.character(as.mo("G apo deli")), "B_GMPHS_APO_DEL")
|
||||
expect_equal(as.character(as.mo("Gomphosphaeria aponina")), "B_GMPHS_APO")
|
||||
expect_equal(as.character(as.mo("Gomphosphaeria species")), "B_GMPHS")
|
||||
@ -152,6 +168,11 @@ test_that("as.mo works", {
|
||||
|
||||
# check old names
|
||||
expect_equal(suppressMessages(as.character(as.mo("Escherichia blattae"))), "B_SHMWL_BLA")
|
||||
# - Didymosphaeria spartinae (unprevalent)
|
||||
expect_warning(suppressMessages(as.mo("D spartin", allow_uncertain = TRUE)))
|
||||
# - was renames to Leptosphaeria obiones
|
||||
expect_equal(suppressWarnings(suppressMessages(as.character(as.mo("D spartin", allow_uncertain = TRUE)))),
|
||||
"F_LPTSP_OBI")
|
||||
|
||||
# check uncertain names
|
||||
expect_equal(suppressWarnings(as.character(as.mo("esco extra_text", allow_uncertain = FALSE))), NA_character_)
|
||||
|
Reference in New Issue
Block a user