mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 09:11:51 +02:00
support for portuguese, language determination based on system
This commit is contained in:
7
tests/testthat/test-data.R
Normal file
7
tests/testthat/test-data.R
Normal file
@ -0,0 +1,7 @@
|
||||
context("data.R")
|
||||
|
||||
test_that("data sets are valid", {
|
||||
# IDs should always be unique
|
||||
expect_identical(nrow(antibiotics), length(unique(antibiotics$atc)))
|
||||
expect_identical(nrow(microorganisms), length(unique(microorganisms$mo)))
|
||||
})
|
@ -10,7 +10,7 @@ test_that("first isolates work", {
|
||||
col_mo = "mo",
|
||||
info = TRUE),
|
||||
na.rm = TRUE),
|
||||
1331)
|
||||
1330)
|
||||
|
||||
# septic_patients contains 1426 out of 2000 first *weighted* isolates
|
||||
expect_equal(
|
||||
@ -24,7 +24,7 @@ test_that("first isolates work", {
|
||||
type = "keyantibiotics",
|
||||
info = TRUE),
|
||||
na.rm = TRUE)),
|
||||
1426)
|
||||
1425)
|
||||
# and 1449 when not ignoring I
|
||||
expect_equal(
|
||||
suppressWarnings(
|
||||
@ -38,7 +38,7 @@ test_that("first isolates work", {
|
||||
type = "keyantibiotics",
|
||||
info = TRUE),
|
||||
na.rm = TRUE)),
|
||||
1449)
|
||||
1448)
|
||||
# and 1430 when using points
|
||||
expect_equal(
|
||||
suppressWarnings(
|
||||
@ -64,7 +64,7 @@ test_that("first isolates work", {
|
||||
info = TRUE,
|
||||
icu_exclude = TRUE),
|
||||
na.rm = TRUE),
|
||||
1176)
|
||||
1175)
|
||||
|
||||
# set 1500 random observations to be of specimen type 'Urine'
|
||||
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)
|
||||
|
@ -13,6 +13,7 @@ test_that("as.mo works", {
|
||||
expect_equal(as.character(as.mo("Klebsiella")), "KLE")
|
||||
expect_equal(as.character(as.mo("K. pneu rhino")), "KLEPNERH") # K. pneumoniae subspp. rhinoscleromatis
|
||||
expect_equal(as.character(as.mo("Bartonella")), "BAR")
|
||||
expect_equal(as.character(as.mo("C. difficile")), "CLODIF")
|
||||
|
||||
expect_equal(as.character(as.mo("S. pyo")), "STCPYO") # not Actinomyces pyogenes
|
||||
|
||||
|
@ -6,8 +6,8 @@ test_that("mo_property works", {
|
||||
expect_equal(mo_species("E. coli"), "coli")
|
||||
expect_equal(mo_subspecies("E. coli"), "")
|
||||
expect_equal(mo_fullname("E. coli"), "Escherichia coli")
|
||||
expect_equal(mo_type("E. coli"), "Bacteria")
|
||||
expect_equal(mo_gramstain("E. coli"), "Negative rods")
|
||||
expect_equal(mo_type("E. coli", language = "en"), "Bacteria")
|
||||
expect_equal(mo_gramstain("E. coli", language = "en"), "Negative rods")
|
||||
expect_equal(mo_aerobic("E. coli"), TRUE)
|
||||
|
||||
expect_equal(mo_shortname("MRSA"), "S. aureus")
|
||||
@ -16,8 +16,8 @@ test_that("mo_property works", {
|
||||
expect_equal(mo_shortname("S. aga"), "S. agalactiae")
|
||||
expect_equal(mo_shortname("S. aga", Lancefield = TRUE), "GBS")
|
||||
|
||||
expect_equal(mo_type("E. coli", language = "de"), "Bakterien")
|
||||
expect_equal(mo_gramstain("E. coli", language = "de"), "Negative Staebchen")
|
||||
expect_equal(mo_type("E. coli", language = "de"), "Bakterium")
|
||||
expect_equal(mo_gramstain("E. coli", language = "de"), "Negative St\u00e4bchen")
|
||||
|
||||
expect_equal(mo_type("E. coli", language = "nl"), "Bacterie")
|
||||
expect_equal(mo_gramstain("E. coli", language = "nl"), "Negatieve staven")
|
||||
|
Reference in New Issue
Block a user