1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 08:32:04 +02:00

unit test fix

This commit is contained in:
2022-08-28 19:17:12 +02:00
parent 0d67db4f32
commit 71db246d5c
27 changed files with 51 additions and 74 deletions

View File

@ -47,7 +47,7 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
expect_warning(AMR:::get_column_abx(rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = FALSE))
}
# we rely on "grouped_tbl" being a class of grouped tibbles, so implement a test that checks for this:
# we rely on "grouped_tbl" being a class of grouped tibbles, so run a test that checks for this:
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
expect_true(AMR:::is_null_or_grouped_tbl(example_isolates %>% group_by(ward)))
}

View File

@ -68,15 +68,15 @@ expect_true(ab_url("AMX") %like% "whocc.no")
expect_warning(ab_url("ASP"))
expect_identical(
colnames(set_ab_names(example_isolates[, 20:25])),
colnames(set_ab_names(example_isolates[, 17:22])),
c("cefoxitin", "cefotaxime", "ceftazidime", "ceftriaxone", "gentamicin", "tobramycin")
)
expect_identical(
colnames(set_ab_names(example_isolates[, 20:25], language = "nl", snake_case = FALSE)),
colnames(set_ab_names(example_isolates[, 17:22], language = "nl", snake_case = FALSE)),
c("Cefoxitine", "Cefotaxim", "Ceftazidim", "Ceftriaxon", "Gentamicine", "Tobramycine")
)
expect_identical(
colnames(set_ab_names(example_isolates[, 20:25], property = "atc")),
colnames(set_ab_names(example_isolates[, 17:22], property = "atc")),
c("J01DC01", "J01DD01", "J01DD02", "J01DD04", "J01GB03", "J01GB01")
)

View File

@ -79,7 +79,7 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
combination = count_susceptible(CIP, GEN)
) %>%
pull(combination),
c(253, 465, 192, 558)
c(946, 428, 94)
)
# count_df

View File

@ -57,7 +57,6 @@ expect_identical(as.ab(antibiotics$name), antibiotics$ab)
datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item", drop = TRUE]
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

@ -75,7 +75,7 @@ expect_equal(
),
na.rm = TRUE
),
941
942
)
# set 1500 random observations to be of specimen type 'Urine'
@ -160,7 +160,7 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
# support for WHONET
expect_message(example_isolates %>%
select(-patient_id) %>%
select(-patient) %>%
mutate(
`First name` = "test",
`Last name` = "test",

View File

@ -84,7 +84,7 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
combination_n = n_rsi(CIP, GEN)
) %>%
pull(combination_n),
c(305, 617, 241, 711)
c(1181, 577, 116)
)
# proportion_df