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

atc_ functions

This commit is contained in:
2019-01-26 23:22:56 +01:00
parent 5493e1f05d
commit f836722269
56 changed files with 1397 additions and 910 deletions

View File

@ -21,27 +21,6 @@
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("guess_atc works", {
expect_equal(as.character(guess_atc(c("J01FA01",
"Erythromycin",
@ -55,7 +34,7 @@ test_that("guess_atc works", {
expect_identical(class(as.atc("amox")), "atc")
expect_identical(class(pull(antibiotics, atc)), "atc")
expect_identical(ab_trivial_nl("Cefmenoxim"), "Cefmenoxim")
expect_identical(atc_trivial_nl("Cefmenoxim"), "Cefmenoxim")
expect_warning(as.atc("Z00ZZ00")) # not yet available in data set
expect_warning(as.atc("UNKNOWN"))

View File

@ -19,20 +19,19 @@
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
context("ab_property.R")
context("atc_property.R")
test_that("ab_property works", {
expect_equal(ab_certe("amox"), "amox")
expect_equal(ab_name("amox", language = "en"), "Amoxicillin")
expect_equal(ab_name("amox", language = "nl"), "Amoxicilline")
expect_equal(ab_official("amox", language = "en"), "Amoxicillin")
expect_equal(ab_trivial_nl("amox"), "Amoxicilline")
expect_equal(ab_umcg("amox"), "AMOX")
expect_equal(class(ab_tradenames("amox")), "character")
expect_equal(class(ab_tradenames(c("amox", "amox"))), "list")
expect_equal(ab_atc("amox"), as.character(as.atc("amox")))
test_that("atc_property works", {
expect_equal(atc_certe("amox"), "amox")
expect_equal(atc_name("amox", language = "en"), "Amoxicillin")
expect_equal(atc_name("amox", language = "nl"), "Amoxicilline")
expect_equal(atc_official("amox", language = "en"), "Amoxicillin")
expect_equal(atc_trivial_nl("amox"), "Amoxicilline")
expect_equal(atc_umcg("amox"), "AMOX")
expect_equal(class(atc_tradenames("amox")), "character")
expect_equal(class(atc_tradenames(c("amox", "amox"))), "list")
expect_error(ab_property("amox", "invalid property"))
expect_error(ab_name("amox", language = "INVALID"))
expect_output(print(ab_name("amox", language = NULL)))
expect_error(atc_property("amox", "invalid property"))
expect_error(atc_name("amox", language = "INVALID"))
expect_output(print(atc_name("amox", language = NULL)))
})