1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 02:03:04 +02:00

(v1.7.1.9016) only_treatable ab selectors

This commit is contained in:
2021-07-08 22:23:28 +02:00
parent 625a6fb304
commit b228eb1536
25 changed files with 112 additions and 79 deletions

View File

@ -28,20 +28,17 @@ expect_equal(mo_kingdom("Escherichia coli"), mo_domain("Escherichia coli"))
expect_equal(mo_phylum("Escherichia coli"), "Proteobacteria")
expect_equal(mo_class("Escherichia coli"), "Gammaproteobacteria")
expect_equal(mo_order("Escherichia coli"), "Enterobacterales")
# S3 class for taxonomic names
expect_inherits(mo_family("Escherichia coli"), "taxonomic_name")
expect_equal(as.character(mo_family("Escherichia coli")), "Enterobacteriaceae")
expect_equal(as.character(mo_fullname("Escherichia coli")), "Escherichia coli")
expect_equal(as.character(mo_genus("Escherichia coli")), "Escherichia")
expect_equal(as.character(mo_name("Escherichia coli")), "Escherichia coli")
expect_equal(as.character(mo_shortname("Escherichia coli")), "E. coli")
expect_equal(as.character(mo_shortname("Escherichia")), "Escherichia")
expect_equal(as.character(mo_shortname("Staphylococcus aureus")), "S. aureus")
expect_equal(as.character(mo_shortname("Staphylococcus aureus", Becker = TRUE)), "S. aureus")
expect_equal(as.character(mo_shortname("Staphylococcus aureus", Becker = "all", language = "en")), "CoPS")
expect_equal(as.character(mo_shortname("Streptococcus agalactiae")), "S. agalactiae")
expect_equal(as.character(mo_shortname("Streptococcus agalactiae", Lancefield = TRUE)), "GBS")
expect_equal(mo_family("Escherichia coli"), "Enterobacteriaceae")
expect_equal(mo_fullname("Escherichia coli"), "Escherichia coli")
expect_equal(mo_genus("Escherichia coli"), "Escherichia")
expect_equal(mo_name("Escherichia coli"), "Escherichia coli")
expect_equal(mo_shortname("Escherichia coli"), "E. coli")
expect_equal(mo_shortname("Escherichia"), "Escherichia")
expect_equal(mo_shortname("Staphylococcus aureus"), "S. aureus")
expect_equal(mo_shortname("Staphylococcus aureus", Becker = TRUE), "S. aureus")
expect_equal(mo_shortname("Staphylococcus aureus", Becker = "all", language = "en"), "CoPS")
expect_equal(mo_shortname("Streptococcus agalactiae"), "S. agalactiae")
expect_equal(mo_shortname("Streptococcus agalactiae", Lancefield = TRUE), "GBS")
expect_equal(mo_species("Escherichia coli"), "coli")
expect_equal(mo_subspecies("Escherichia coli"), "")
@ -68,7 +65,7 @@ expect_true(mo_url("Escherichia coli") %like% "lpsn.dsmz.de")
# test integrity
MOs <- microorganisms
expect_identical(MOs$fullname, as.character(mo_fullname(MOs$fullname, language = "en")))
expect_identical(MOs$fullname, mo_fullname(MOs$fullname, language = "en"))
# check languages
expect_equal(mo_type("Escherichia coli", language = "de"), "Bakterien")
@ -84,7 +81,7 @@ expect_stdout(print(mo_gramstain("Escherichia coli", language = "fr")))
expect_error(mo_gramstain("Escherichia coli", language = "UNKNOWN"))
dutch <- mo_name(microorganisms$fullname, language = "nl") # should be transformable to English again
expect_identical(as.character(mo_name(dutch, language = NULL)), microorganisms$fullname) # gigantic test - will run ALL names
expect_identical(mo_name(dutch, language = NULL), microorganisms$fullname) # gigantic test - will run ALL names
# manual property function
expect_error(mo_property("Escherichia coli", property = c("tsn", "fullname")))
@ -120,7 +117,7 @@ expect_equal(mo_is_intrinsic_resistant(c("Escherichia coli", "Staphylococcus aur
"vanco"),
c(TRUE, FALSE, FALSE))
# with reference data
expect_equal(as.character(mo_name("test", reference_df = data.frame(col1 = "test", mo = "B_ESCHR_COLI"))),
expect_equal(mo_name("test", reference_df = data.frame(col1 = "test", mo = "B_ESCHR_COLI")),
"Escherichia coli")
if (AMR:::pkg_is_available("dplyr")) {
expect_equal(example_isolates %>% filter(mo_is_gram_negative()) %>% nrow(),