mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 23:21:56 +02:00
fix for printing tibbles, improve guess_bactid
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
context("atc.R")
|
||||
|
||||
|
||||
test_that("atc_property works", {
|
||||
expect_equal(tolower(atc_property("J01CA04", property = "Name")), "amoxicillin")
|
||||
expect_equivalent(atc_property("J01CA04", "DDD"), 1)
|
||||
@ -15,21 +14,6 @@ test_that("abname works", {
|
||||
expect_equal(abname("J01CA04", from = 'atc'), "Amoxicillin")
|
||||
})
|
||||
|
||||
test_that("guess_bactid works", {
|
||||
expect_identical(guess_bactid(c("E. coli", "H. influenzae")), c("ESCCOL", "HAEINF"))
|
||||
expect_equal(guess_bactid("Escherichia coli"), "ESCCOL")
|
||||
expect_equal(guess_bactid("Negative rods"), "GNR")
|
||||
expect_equal(guess_bactid(c("stau",
|
||||
"STAU",
|
||||
"staaur",
|
||||
"S. aureus",
|
||||
"S aureus",
|
||||
"Staphylococcus aureus",
|
||||
"MRSA",
|
||||
"VISA")),
|
||||
rep("STAAUR", 8))
|
||||
})
|
||||
|
||||
test_that("guess_atc works", {
|
||||
expect_equal(guess_atc(c("J01FA01",
|
||||
"Erythromycin",
|
||||
|
40
tests/testthat/test-guess_bactid.R
Normal file
40
tests/testthat/test-guess_bactid.R
Normal file
@ -0,0 +1,40 @@
|
||||
context("guess_bactid.R")
|
||||
|
||||
test_that("guess_bactid works", {
|
||||
expect_identical(
|
||||
guess_bactid(c("E. coli", "H. influenzae")),
|
||||
c("ESCCOL", "HAEINF"))
|
||||
|
||||
expect_equal(guess_bactid("Escherichia coli"), "ESCCOL")
|
||||
|
||||
expect_equal(guess_bactid("Negative rods"), "GNR")
|
||||
|
||||
expect_identical(
|
||||
guess_bactid(c("stau",
|
||||
"STAU",
|
||||
"staaur",
|
||||
"S. aureus",
|
||||
"S aureus",
|
||||
"Staphylococcus aureus",
|
||||
"MRSA",
|
||||
"VISA")),
|
||||
rep("STAAUR", 8))
|
||||
|
||||
# select with one column
|
||||
expect_identical(
|
||||
septic_patients[1:10,] %>%
|
||||
left_join_microorganisms() %>%
|
||||
select(genus) %>%
|
||||
guess_bactid(),
|
||||
c("STC", "STC", "NEI", "STA", "STA",
|
||||
"NEI", "ENT", "ENT", "ESC", "KLE"))
|
||||
|
||||
# select with two columns
|
||||
expect_identical(
|
||||
septic_patients[1:10,] %>%
|
||||
pull(bactid),
|
||||
septic_patients[1:10,] %>%
|
||||
left_join_microorganisms() %>%
|
||||
select(genus, species) %>%
|
||||
guess_bactid())
|
||||
})
|
Reference in New Issue
Block a user