mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 14:01:55 +02:00
(v1.3.0.9036) documentation fix
This commit is contained in:
7
tests/testthat/test-_all_examples.R → tests/testthat/test-_deprecated.R
Executable file → Normal file
7
tests/testthat/test-_all_examples.R → tests/testthat/test-_deprecated.R
Executable file → Normal file
@ -18,3 +18,10 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("deprecated.R")
|
||||
|
||||
test_that("deprecated functions work", {
|
||||
skip_on_cran()
|
||||
# if some functions get deprecated, put the tests here
|
||||
})
|
@ -19,7 +19,7 @@
|
||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("misc.R")
|
||||
context("aa_helper_functions.R")
|
||||
|
||||
test_that("percentages works", {
|
||||
skip_on_cran()
|
||||
@ -50,3 +50,40 @@ test_that("looking up ab columns works", {
|
||||
expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = TRUE))
|
||||
expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = FALSE))
|
||||
})
|
||||
|
||||
test_that("imports work", {
|
||||
skip_on_cran()
|
||||
|
||||
import_functions <- c(
|
||||
"anti_join" = "dplyr",
|
||||
"cur_column" = "dplyr",
|
||||
"freq.default" = "cleaner",
|
||||
"full_join" = "dplyr",
|
||||
"has_internet" = "curl",
|
||||
"html_attr" = "rvest",
|
||||
"html_children" = "rvest",
|
||||
"html_node" = "rvest",
|
||||
"html_nodes" = "rvest",
|
||||
"html_table" = "rvest",
|
||||
"html_text" = "rvest",
|
||||
"inline_hist" = "skimr",
|
||||
"inner_join" = "dplyr",
|
||||
"insertText" = "rstudioapi",
|
||||
"left_join" = "dplyr",
|
||||
"new_pillar_shaft_simple" = "pillar",
|
||||
"peek_mask" = "dplyr",
|
||||
"peek_vars" = "tidyselect",
|
||||
"read_excel" = "readxl",
|
||||
"read_html" = "xml2",
|
||||
"right_join" = "dplyr",
|
||||
"semi_join" = "dplyr",
|
||||
"sfl" = "skimr",
|
||||
"showQuestion" = "rstudioapi")
|
||||
|
||||
for (i in seq_len(length(import_functions))) {
|
||||
fn <- names(import_functions)[i]
|
||||
pkg <- unname(import_functions[i])
|
||||
expect(!is.null(import_fn(name = fn, pkg = pkg, error_on_fail = FALSE)),
|
||||
failure_message = paste0("Function ", pkg, "::", fn, "() does not exist"))
|
||||
}
|
||||
})
|
@ -1,31 +0,0 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2020 Berends MS, Luz CF et al. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# #
|
||||
# We created this package for both routine data analysis and academic #
|
||||
# research and it was publicly released in the hope that it will be #
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("deprecated.R")
|
||||
|
||||
test_that("deprecated functions work", {
|
||||
skip_on_cran()
|
||||
expect_equal(suppressWarnings(portion_S(example_isolates$AMX)), proportion_S(example_isolates$AMX))
|
||||
expect_equal(suppressWarnings(portion_SI(example_isolates$AMX)), proportion_SI(example_isolates$AMX))
|
||||
expect_equal(suppressWarnings(portion_I(example_isolates$AMX)), proportion_I(example_isolates$AMX))
|
||||
expect_equal(suppressWarnings(portion_IR(example_isolates$AMX)), proportion_IR(example_isolates$AMX))
|
||||
expect_equal(suppressWarnings(portion_R(example_isolates$AMX)), proportion_R(example_isolates$AMX))
|
||||
})
|
@ -1,49 +0,0 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2020 Berends MS, Luz CF et al. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# #
|
||||
# We created this package for both routine data analysis and academic #
|
||||
# research and it was publicly released in the hope that it will be #
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("import_fn.R")
|
||||
|
||||
test_that("imports work", {
|
||||
skip_on_cran()
|
||||
|
||||
import_functions <- c(
|
||||
cleaner = "freq.default",
|
||||
curl = "has_internet",
|
||||
dplyr = "cur_column",
|
||||
dplyr = "peek_mask",
|
||||
readxl = "read_excel",
|
||||
rstudioapi = "showQuestion",
|
||||
rvest = "html_attr",
|
||||
rvest = "html_children",
|
||||
rvest = "html_node",
|
||||
rvest = "html_nodes",
|
||||
rvest = "html_table",
|
||||
rvest = "html_text",
|
||||
tidyselect = "peek_vars",
|
||||
xml2 = "read_html")
|
||||
|
||||
for (i in seq_len(length(import_functions))) {
|
||||
pkg <- names(import_functions)[i]
|
||||
fn <- unname(import_functions[i])
|
||||
expect(!is.null(import_fn(name = fn, pkg = pkg, error_on_fail = FALSE)),
|
||||
failure_message = paste0("Function ", pkg, "::", fn, "() does not exist"))
|
||||
}
|
||||
})
|
@ -40,6 +40,7 @@ test_that("mic works", {
|
||||
expect_s3_class(c(x[1], x[9]), "mic")
|
||||
expect_s3_class(unique(x[1], x[9]), "mic")
|
||||
expect_warning(as.mic("INVALID VALUE"))
|
||||
|
||||
|
||||
pdf(NULL) # prevent Rplots.pdf being created
|
||||
expect_silent(barplot(as.mic(c(1, 2, 4, 8))))
|
||||
|
Reference in New Issue
Block a user