From 8d37c75860f01c51093bf70ac2ad9a1944c7adcc Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Tue, 14 Feb 2023 15:59:40 +0100 Subject: [PATCH] unit tests --- DESCRIPTION | 2 +- NEWS.md | 2 +- inst/tinytest/test-age.R | 11 ++--------- inst/tinytest/test-count.R | 5 +---- inst/tinytest/test-g.test.R | 6 +----- inst/tinytest/test-mdro.R | 8 ++++---- inst/tinytest/test-proportion.R | 10 ++-------- inst/tinytest/test-rsi.R | 5 +---- 8 files changed, 13 insertions(+), 36 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 57b6f0c9..09caf244 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.8.2.9124 +Version: 1.8.2.9125 Date: 2023-02-14 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 52b1cfd8..bb8e0cf6 100755 --- a/NEWS.md +++ b/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!)* diff --git a/inst/tinytest/test-age.R b/inst/tinytest/test-age.R index 0952ceb1..5e8bf005 100644 --- a/inst/tinytest/test-age.R +++ b/inst/tinytest/test-age.R @@ -49,15 +49,8 @@ expect_error(age( reference = c("2019-01-01", "2019-01-01") )) -# expect_warning(age( - x = c("1980-01-01", "1985-01-01", "1990-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_warning(age(x = c("1980-01-01", "1985-01-01", "1990-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( length(age(x = c("2019-01-01", NA), na.rm = TRUE)), diff --git a/inst/tinytest/test-count.R b/inst/tinytest/test-count.R index 73c2fcf4..9af023e0 100644 --- a/inst/tinytest/test-count.R +++ b/inst/tinytest/test-count.R @@ -47,10 +47,7 @@ expect_equal( # warning for speed loss # expect_warning(count_resistant(as.character(example_isolates$AMC))) -# expect_warning(count_resistant( - example_isolates$AMC, - as.character(example_isolates$GEN) -)) +# expect_warning(count_resistant(example_isolates$AMC, as.character(example_isolates$GEN))) # check for errors expect_error(count_resistant("test", minimum = "test")) diff --git a/inst/tinytest/test-g.test.R b/inst/tinytest/test-g.test.R index 0c934b74..f3fb0af8 100644 --- a/inst/tinytest/test-g.test.R +++ b/inst/tinytest/test-g.test.R @@ -63,11 +63,7 @@ x <- as.data.frame( # expect_warning(g.test(x)) expect_true(suppressWarnings(g.test(x)$p.value) < 1) -# expect_warning(g.test( - x = c(772, 1611, 737), - y = c(780, 1560, 780), - rescale.p = TRUE -)) +# expect_warning(g.test(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(0, 0, 0, 0), ncol = 2, byrow = TRUE))) diff --git a/inst/tinytest/test-mdro.R b/inst/tinytest/test-mdro.R index 6a7dde2d..6b829107 100755 --- a/inst/tinytest/test-mdro.R +++ b/inst/tinytest/test-mdro.R @@ -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" ~ A)) # expect_warning(mdro(example_isolates, - # since `test` gives an error, it will be ignored with a warning - guideline = custom_mdro_guideline(test ~ "A"), - info = FALSE -)) +# # since `test` gives an error, it will be ignored with a warning +# guideline = custom_mdro_guideline(test ~ "A"), +# info = FALSE +# )) # print groups if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) { diff --git a/inst/tinytest/test-proportion.R b/inst/tinytest/test-proportion.R index 5a042444..b80d3e3f 100755 --- a/inst/tinytest/test-proportion.R +++ b/inst/tinytest/test-proportion.R @@ -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_S(as.character(example_isolates$AMC))) -# expect_warning(proportion_S(as.character( - example_isolates$AMC, - example_isolates$GEN -))) +# expect_warning(proportion_S(as.character(example_isolates$AMC, example_isolates$GEN))) -# expect_warning(n_sir(as.character( - example_isolates$AMC, - example_isolates$GEN -))) +# expect_warning(n_sir(as.character(example_isolates$AMC, example_isolates$GEN))) expect_equal( suppressWarnings(n_sir(as.character( example_isolates$AMC, diff --git a/inst/tinytest/test-rsi.R b/inst/tinytest/test-rsi.R index ef9fdd6e..e4ba121d 100644 --- a/inst/tinytest/test-rsi.R +++ b/inst/tinytest/test-rsi.R @@ -236,10 +236,7 @@ expect_inherits( ))$amoxi), "sir" ) -# expect_warning(as.sir(data.frame( - mo = "E. coli", - NIT = c("<= 2", 32) -))) +# expect_warning(as.sir(data.frame(mo = "E. coli", NIT = c("<= 2", 32)))) expect_message(as.sir(data.frame( mo = "E. coli", NIT = c("<= 2", 32),