mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 07:26:12 +01:00
unit tests
This commit is contained in:
parent
a4cd38c433
commit
8d37c75860
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.8.2.9124
|
Version: 1.8.2.9125
|
||||||
Date: 2023-02-14
|
Date: 2023-02-14
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 1.8.2.9124
|
# AMR 1.8.2.9125
|
||||||
|
|
||||||
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*
|
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*
|
||||||
|
|
||||||
|
@ -49,15 +49,8 @@ expect_error(age(
|
|||||||
reference = c("2019-01-01", "2019-01-01")
|
reference = c("2019-01-01", "2019-01-01")
|
||||||
))
|
))
|
||||||
|
|
||||||
# expect_warning(age(
|
# expect_warning(age(x = c("1980-01-01", "1985-01-01", "1990-01-01"), reference = "1975-01-01"))
|
||||||
x = c("1980-01-01", "1985-01-01", "1990-01-01"),
|
# expect_warning(age(x = c("1800-01-01", "1805-01-01", "1810-01-01"), reference = "2019-01-01"))
|
||||||
reference = "1975-01-01"
|
|
||||||
))
|
|
||||||
|
|
||||||
# expect_warning(age(
|
|
||||||
x = c("1800-01-01", "1805-01-01", "1810-01-01"),
|
|
||||||
reference = "2019-01-01"
|
|
||||||
))
|
|
||||||
|
|
||||||
expect_equal(
|
expect_equal(
|
||||||
length(age(x = c("2019-01-01", NA), na.rm = TRUE)),
|
length(age(x = c("2019-01-01", NA), na.rm = TRUE)),
|
||||||
|
@ -47,10 +47,7 @@ expect_equal(
|
|||||||
# warning for speed loss
|
# warning for speed loss
|
||||||
# expect_warning(count_resistant(as.character(example_isolates$AMC)))
|
# expect_warning(count_resistant(as.character(example_isolates$AMC)))
|
||||||
|
|
||||||
# expect_warning(count_resistant(
|
# expect_warning(count_resistant(example_isolates$AMC, as.character(example_isolates$GEN)))
|
||||||
example_isolates$AMC,
|
|
||||||
as.character(example_isolates$GEN)
|
|
||||||
))
|
|
||||||
|
|
||||||
# check for errors
|
# check for errors
|
||||||
expect_error(count_resistant("test", minimum = "test"))
|
expect_error(count_resistant("test", minimum = "test"))
|
||||||
|
@ -63,11 +63,7 @@ x <- as.data.frame(
|
|||||||
# expect_warning(g.test(x))
|
# expect_warning(g.test(x))
|
||||||
expect_true(suppressWarnings(g.test(x)$p.value) < 1)
|
expect_true(suppressWarnings(g.test(x)$p.value) < 1)
|
||||||
|
|
||||||
# expect_warning(g.test(
|
# expect_warning(g.test(x = c(772, 1611, 737), y = c(780, 1560, 780), rescale.p = TRUE))
|
||||||
x = c(772, 1611, 737),
|
|
||||||
y = c(780, 1560, 780),
|
|
||||||
rescale.p = TRUE
|
|
||||||
))
|
|
||||||
|
|
||||||
expect_error(g.test(matrix(data = c(-1, -2, -3, -4), ncol = 2, byrow = TRUE)))
|
expect_error(g.test(matrix(data = c(-1, -2, -3, -4), ncol = 2, byrow = TRUE)))
|
||||||
expect_error(g.test(matrix(data = c(0, 0, 0, 0), ncol = 2, byrow = TRUE)))
|
expect_error(g.test(matrix(data = c(0, 0, 0, 0), ncol = 2, byrow = TRUE)))
|
||||||
|
@ -272,10 +272,10 @@ expect_error(custom_mdro_guideline("test"))
|
|||||||
expect_error(custom_mdro_guideline("test" ~ c(1:3)))
|
expect_error(custom_mdro_guideline("test" ~ c(1:3)))
|
||||||
expect_error(custom_mdro_guideline("test" ~ A))
|
expect_error(custom_mdro_guideline("test" ~ A))
|
||||||
# expect_warning(mdro(example_isolates,
|
# expect_warning(mdro(example_isolates,
|
||||||
# since `test` gives an error, it will be ignored with a warning
|
# # since `test` gives an error, it will be ignored with a warning
|
||||||
guideline = custom_mdro_guideline(test ~ "A"),
|
# guideline = custom_mdro_guideline(test ~ "A"),
|
||||||
info = FALSE
|
# info = FALSE
|
||||||
))
|
# ))
|
||||||
|
|
||||||
# print groups
|
# print groups
|
||||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
|
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
|
||||||
|
@ -115,15 +115,9 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
|
|||||||
|
|
||||||
# expect_warning(proportion_R(as.character(example_isolates$AMC)))
|
# expect_warning(proportion_R(as.character(example_isolates$AMC)))
|
||||||
# expect_warning(proportion_S(as.character(example_isolates$AMC)))
|
# expect_warning(proportion_S(as.character(example_isolates$AMC)))
|
||||||
# expect_warning(proportion_S(as.character(
|
# expect_warning(proportion_S(as.character(example_isolates$AMC, example_isolates$GEN)))
|
||||||
example_isolates$AMC,
|
|
||||||
example_isolates$GEN
|
|
||||||
)))
|
|
||||||
|
|
||||||
# expect_warning(n_sir(as.character(
|
# expect_warning(n_sir(as.character(example_isolates$AMC, example_isolates$GEN)))
|
||||||
example_isolates$AMC,
|
|
||||||
example_isolates$GEN
|
|
||||||
)))
|
|
||||||
expect_equal(
|
expect_equal(
|
||||||
suppressWarnings(n_sir(as.character(
|
suppressWarnings(n_sir(as.character(
|
||||||
example_isolates$AMC,
|
example_isolates$AMC,
|
||||||
|
@ -236,10 +236,7 @@ expect_inherits(
|
|||||||
))$amoxi),
|
))$amoxi),
|
||||||
"sir"
|
"sir"
|
||||||
)
|
)
|
||||||
# expect_warning(as.sir(data.frame(
|
# expect_warning(as.sir(data.frame(mo = "E. coli", NIT = c("<= 2", 32))))
|
||||||
mo = "E. coli",
|
|
||||||
NIT = c("<= 2", 32)
|
|
||||||
)))
|
|
||||||
expect_message(as.sir(data.frame(
|
expect_message(as.sir(data.frame(
|
||||||
mo = "E. coli",
|
mo = "E. coli",
|
||||||
NIT = c("<= 2", 32),
|
NIT = c("<= 2", 32),
|
||||||
|
Loading…
Reference in New Issue
Block a user