mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 22:22:03 +02:00
AI improvements
This commit is contained in:
@ -1,25 +1,25 @@
|
||||
context("atc.R")
|
||||
|
||||
test_that("atc_property works", {
|
||||
#skip_on_cran() # relies on internet connection of server, don't test
|
||||
#skip_on_appveyor() # security error on AppVeyor
|
||||
|
||||
if (!is.null(curl::nslookup("www.whocc.no", error = FALSE))) {
|
||||
expect_equal(tolower(atc_property("J01CA04", property = "Name")), "amoxicillin")
|
||||
expect_equal(atc_property("J01CA04", property = "unit"), "g")
|
||||
expect_equal(atc_property("J01CA04", property = "DDD"),
|
||||
atc_ddd("J01CA04"))
|
||||
|
||||
expect_identical(atc_property("J01CA04", property = "Groups"),
|
||||
atc_groups("J01CA04"))
|
||||
|
||||
expect_warning(atc_property("ABCDEFG", property = "DDD"))
|
||||
|
||||
expect_error(atc_property("J01CA04", property = c(1:5)))
|
||||
expect_error(atc_property("J01CA04", property = "test"))
|
||||
expect_error(atc_property("J01CA04", property = "test", administration = c(1:5)))
|
||||
}
|
||||
})
|
||||
# test_that("atc_property works", {
|
||||
# skip_on_cran() # relies on internet connection of server, don't test
|
||||
# skip_on_appveyor() # security error on AppVeyor
|
||||
#
|
||||
# if (!is.null(curl::nslookup("www.whocc.no", error = FALSE))) {
|
||||
# expect_equal(tolower(atc_property("J01CA04", property = "Name")), "amoxicillin")
|
||||
# expect_equal(atc_property("J01CA04", property = "unit"), "g")
|
||||
# expect_equal(atc_property("J01CA04", property = "DDD"),
|
||||
# atc_ddd("J01CA04"))
|
||||
#
|
||||
# expect_identical(atc_property("J01CA04", property = "Groups"),
|
||||
# atc_groups("J01CA04"))
|
||||
#
|
||||
# expect_warning(atc_property("ABCDEFG", property = "DDD"))
|
||||
#
|
||||
# expect_error(atc_property("J01CA04", property = c(1:5)))
|
||||
# expect_error(atc_property("J01CA04", property = "test"))
|
||||
# expect_error(atc_property("J01CA04", property = "test", administration = c(1:5)))
|
||||
# }
|
||||
# })
|
||||
|
||||
test_that("guess_atc works", {
|
||||
expect_equal(as.character(guess_atc(c("J01FA01",
|
||||
|
@ -21,7 +21,7 @@ test_that("mic works", {
|
||||
plot(as.mic(c(1, 2, 4, 8)))
|
||||
print(as.mic(c(1, 2, 4, 8)))
|
||||
|
||||
expect_equal(summary(as.mic(c(2, 8))), c("Mode" = 'mic',
|
||||
expect_equal(summary(as.mic(c(2, 8))), c("Class" = "mic",
|
||||
"<NA>" = "0",
|
||||
"Min." = "2",
|
||||
"Max." = "8"))
|
||||
|
@ -214,10 +214,10 @@ test_that("as.mo works", {
|
||||
expect_equal(as.character(suppressWarnings(as.mo(
|
||||
c("Microbacterium paraoxidans",
|
||||
"Streptococcus suis (bovis gr)",
|
||||
"Raoultella (here some text) terrigena"), allow_uncertain = TRUE))),
|
||||
"Raoultella (here some text) terrigena")))),
|
||||
c("B_MCRBC", "B_STRPTC_SUI", "B_RLTLL_TER"))
|
||||
|
||||
# Salmonella (City) are all actually Salmonella enterica spp (City)
|
||||
expect_equal(as.character(suppressMessages(as.mo("Salmonella Goettingen", allow_uncertain = TRUE))),
|
||||
expect_equal(as.character(suppressMessages(as.mo("Salmonella Goettingen"))),
|
||||
"B_SLMNL_ENT")
|
||||
})
|
||||
|
@ -13,7 +13,7 @@ test_that("rsi works", {
|
||||
|
||||
expect_equal(suppressWarnings(as.logical(as.rsi("INVALID VALUE"))), NA)
|
||||
|
||||
expect_equal(summary(as.rsi(c("S", "R"))), c("Mode" = 'rsi',
|
||||
expect_equal(summary(as.rsi(c("S", "R"))), c("Class" = "rsi",
|
||||
"<NA>" = "0",
|
||||
"Sum S" = "1",
|
||||
"Sum IR" = "1",
|
||||
|
Reference in New Issue
Block a user