1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 01:22:25 +02:00

(v1.7.1.9020) autoplot generics

This commit is contained in:
2021-07-12 20:24:49 +02:00
parent fc946564d1
commit 6838f03bde
27 changed files with 197 additions and 341 deletions

View File

@ -52,6 +52,7 @@ expect_identical(as.ab(antibiotics$name), antibiotics$ab)
datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item"]
for (i in seq_len(length(datasets))) {
dataset <- get(datasets[i], envir = asNamespace("AMR"))
expect_identical(class(dataset), "data.frame")
expect_identical(AMR:::dataset_UTF8_to_ASCII(dataset), dataset, info = datasets[i])
}

View File

@ -44,9 +44,9 @@ expect_silent(plot(as.disk(c(10, 20, 40))))
expect_silent(plot(as.disk(c(10, 20, 40)), expand = FALSE))
expect_silent(plot(as.disk(c(10, 20, 40)), mo = "esco", ab = "cipr"))
if (AMR:::pkg_is_available("ggplot2")) {
expect_inherits(ggplot(as.disk(c(10, 20, 40))), "gg")
expect_inherits(ggplot(as.disk(c(10, 20, 40)), expand = FALSE), "gg")
expect_inherits(ggplot(as.disk(c(10, 20, 40)), mo = "esco", ab = "cipr"), "gg")
expect_inherits(autoplot(as.disk(c(10, 20, 40))), "gg")
expect_inherits(autoplot(as.disk(c(10, 20, 40)), expand = FALSE), "gg")
expect_inherits(autoplot(as.disk(c(10, 20, 40)), mo = "esco", ab = "cipr"), "gg")
}
expect_stdout(print(as.disk(12)))

View File

@ -50,9 +50,9 @@ expect_silent(plot(as.mic(c(1, 2, 4, 8))))
expect_silent(plot(as.mic(c(1, 2, 4, 8)), expand = FALSE))
expect_silent(plot(as.mic(c(1, 2, 4, 8)), mo = "esco", ab = "cipr"))
if (AMR:::pkg_is_available("ggplot2")) {
expect_inherits(ggplot(as.mic(c(1, 2, 4, 8))), "gg")
expect_inherits(ggplot(as.mic(c(1, 2, 4, 8)), expand = FALSE), "gg")
expect_inherits(ggplot(as.mic(c(1, 2, 4, 8, 32)), mo = "esco", ab = "cipr"), "gg")
expect_inherits(autoplot(as.mic(c(1, 2, 4, 8))), "gg")
expect_inherits(autoplot(as.mic(c(1, 2, 4, 8)), expand = FALSE), "gg")
expect_inherits(autoplot(as.mic(c(1, 2, 4, 8, 32)), mo = "esco", ab = "cipr"), "gg")
}
expect_stdout(print(as.mic(c(1, 2, 4, 8))))

View File

@ -45,7 +45,7 @@ pdf(NULL) # prevent Rplots.pdf being created
expect_silent(plot(x))
if (AMR:::pkg_is_available("ggplot2")) {
expect_silent(ggplot_rsi_predict(x))
expect_silent(ggplot(x))
expect_silent(autoplot(x))
expect_error(ggplot_rsi_predict(example_isolates))
}
expect_stdout(rsi_predict(x = subset(example_isolates, mo == "B_ESCHR_COLI"),

View File

@ -34,7 +34,9 @@ expect_inherits(unique(x[1], x[9]), "rsi")
pdf(NULL) # prevent Rplots.pdf being created
expect_silent(barplot(as.rsi(c("S", "I", "R"))))
expect_silent(plot(as.rsi(c("S", "I", "R"))))
if (AMR:::pkg_is_available("ggplot2")) expect_inherits(ggplot(as.rsi(c("S", "I", "R"))), "gg")
if (AMR:::pkg_is_available("ggplot2")) {
expect_inherits(autoplot(as.rsi(c("S", "I", "R"))), "gg")
}
expect_stdout(print(as.rsi(c("S", "I", "R"))))
expect_equal(as.character(as.rsi(c(1:3))), c("S", "I", "R"))
expect_equal(suppressWarnings(as.logical(as.rsi("INVALID VALUE"))), NA)