Skip to content

Commit

Permalink
Merge pull request #1514 from pharmaverse/pre-release
Browse files Browse the repository at this point in the history
Release v0.8.4
  • Loading branch information
bms63 authored Oct 17, 2022
2 parents 7059ed1 + f3675f1 commit 5129b2e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 64 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: admiral
Type: Package
Title: ADaM in R Asset Library
Version: 0.8.3
Version: 0.8.4
Authors@R: c(
person("Thomas", "Neitmann", email = "thomas.neitmann@roche.com", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# admiral 0.8.4

- Fixed a bug where a recent update to `{lifecylce}` caused several `admiral` tests to break (#1500)

# admiral 0.8.3

- Second attempt to address issue where CRAN identified a failing test when "a strict Latin-1* locale" is used (#1469)
Expand Down
123 changes: 60 additions & 63 deletions tests/testthat/test-deprecation.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
library(admiral.test)
library(rlang)
library(tibble)
data("admiral_dm")

adsl <- tribble(
adsl <- tibble::tribble(
~USUBJID, ~SEX, ~COUNTRY,
"ST42-1", "F", "AUT",
"ST42-2", "M", "MWI",
"ST42-3", "M", "NOR",
"ST42-4", "F", "UGA"
) %>% mutate(STUDYID = "ST42")

ex <- tribble(
ex <- tibble::tribble(
~USUBJID, ~EXSTDTC,
"ST42-1", "2020-12-07",
"ST42-1", "2020-12-14",
Expand All @@ -20,73 +15,76 @@ ex <- tribble(
"ST42-3", "2021-03-02"
) %>% mutate(STUDYID = "ST42")

test_that("An error is thrown if `derive_var_extreme_flag()` with `filter` argument is called", {
## Test 1: An error is thrown if `derive_var_extreme_flag()` with `filter` argument is called ----
test_that("deprecation Test 1: An error is thrown if `derive_var_extreme_flag()`
with `filter` argument is called", {
expect_error(
derive_var_extreme_flag(
filter = !is.na(AVAL)
),
"deprecated",
fixed = TRUE,
class = "lifecycle_error_deprecated"
)
})

test_that("An error is thrown if `derive_var_worst_flag()` with `filter` argument is called", {
## Test 2: An error is thrown if `derive_var_worst_flag()` with `filter` argument is called ----
test_that("deprecation Test 2: An error is thrown if `derive_var_worst_flag()`
with `filter` argument is called", {
expect_error(
derive_var_worst_flag(
filter = !is.na(AVAL)
),
"deprecated",
fixed = TRUE,
class = "lifecycle_error_deprecated"
)
})

test_that("derive_var_ady() Test 1: An error is thrown if `derive_var_ady()` is called", {
## Test 3: derive_var_ady() An error is thrown if `derive_var_ady()` is called ----
test_that("deprecation Test 3: derive_var_ady() An error is thrown if
`derive_var_ady()` is called", {
expect_error(
derive_var_ady(),
"deprecated",
fixed = TRUE,
class = "lifecycle_error_deprecated"
)
})

test_that("derive_var_aendy Test 1: An error is thrown if `derive_var_aendy()` is called", {
## Test 4: An error is thrown if `derive_var_aendy()` is called ----
test_that("deprecation Test 4: An error is thrown if `derive_var_aendy()`
is called", {
expect_error(
derive_var_aendy(),
"deprecated",
fixed = TRUE,
class = "lifecycle_error_deprecated"
)
})

test_that("derive_var_astdy Test 1: An error is thrown if `derive_var_astdy()` is called", {
## Test 5: An error is thrown if `derive_var_astdy()` is called ----
test_that("deprecation Test 5: An error is thrown if `derive_var_astdy()`
is called", {
expect_error(
derive_var_astdy(),
"deprecated",
fixed = TRUE,
class = "lifecycle_error_deprecated"
)
})

test_that("derive_var_atirel Test 1: An error is thrown if `derive_var_atirel()` is called", {
## Test 6: An error is thrown if `derive_var_atirel()` is called ----
test_that("deprecation Test 6: An error is thrown if `derive_var_atirel()`
is called", {
expect_error(
derive_var_atirel(),
"deprecated",
fixed = TRUE,
class = "lifecycle_error_deprecated"
)
})

test_that("derive_vars_suppqual Test 1: An error is thrown if `derive_vars_suppqual()` is called", {
## Test 7: An error is thrown if `derive_vars_suppqual()` is called ----
test_that("deprecation Test 7: An error is thrown if `derive_vars_suppqual()`
is called", {
expect_error(
derive_vars_suppqual(),
"deprecated",
fixed = TRUE
class = "lifecycle_error_deprecated"
)
})

test_that("derive_derived_param Test 1: A warning is issued if `derive_derived_param()` is called", { # nolint
## Test 8: A warning is issued if `derive_derived_param()` is called ----
test_that("deprecation Test 8: A warning is issued if `derive_derived_param()`
is called", {
input <- tibble::tribble(
~USUBJID, ~PARAMCD, ~PARAM, ~AVAL, ~AVALU, ~VISIT,
"01-701-1015", "DIABP", "Diastolic Blood Pressure (mmHg)", 51, "mmHg", "BASELINE",
Expand All @@ -111,12 +109,13 @@ test_that("derive_derived_param Test 1: A warning is issued if `derive_derived_p
AVALU = "mmHg"
)
),
"deprecated",
fixed = TRUE
class = "lifecycle_warning_deprecated"
)
})

test_that("derive_vars_merged_dt: a deprecation warning is issued", {
## Test 9: derive_vars_merged_dt: a deprecation warning is issued ----
test_that("deprecation Test 9: derive_vars_merged_dt: a deprecation warning
is issued", {
expect_warning(
derive_vars_merged_dt(
adsl,
Expand All @@ -128,11 +127,13 @@ test_that("derive_vars_merged_dt: a deprecation warning is issued", {
new_vars_prefix = "TRTS",
mode = "first"
),
"deprecated"
class = "lifecycle_warning_deprecated"
)
})

test_that("derive_vars_merged_dtm: a deprecation warning is issued", {
## Test 10: derive_vars_merged_dtm: a deprecation warning is issued ----
test_that("deprecation Test 10: derive_vars_merged_dtm: a deprecation warning
is issued", {
expect_warning(
derive_vars_merged_dtm(
adsl,
Expand All @@ -144,71 +145,67 @@ test_that("derive_vars_merged_dtm: a deprecation warning is issued", {
time_imputation = "first",
mode = "first"
),
"deprecated"
class = "lifecycle_warning_deprecated"
)
})

test_that("date_source: errors when date_imputation is specified", {
## Test 11: date_source: errors when date_imputation is specified ----
test_that("deprecation Test 11: date_source: errors when date_imputation
is specified", {
expect_error(
date_source(
dataset_name = "ae",
date = ASTDTM,
date_imputation = "first"
),
paste(
"The `date_imputation` argument of `date_source\\(\\)` .* deprecated .* admiral 0.8.0.*",
"Please use `derive_vars_dtm\\(\\)` to convert DTC variables to datetime variables in the dataset.", # nolint
sep = "\n"
)
class = "lifecycle_error_deprecated"
)
})

test_that("date_source: errors when time_imputation is specified", {
## Test 12: date_source: errors when time_imputation is specified ----
test_that("deprecation Test 12: date_source: errors when time_imputation
is specified", {
expect_error(
date_source(
dataset_name = "ae",
date = ASTDTM,
time_imputation = "first"
),
paste(
"The `time_imputation` argument of `date_source\\(\\)` .* deprecated .* admiral 0.8.0.*",
"Please use `derive_vars_dtm\\(\\)` to convert DTC variables to datetime variables in the dataset.", # nolint
sep = "\n"
)
class = "lifecycle_error_deprecated"
)
})

test_that("date_source: errors when preserve is specified", {
## Test 13: date_source: errors when preserve is specified ----
test_that("deprecation Test 13: date_source: errors when preserve
is specified", {
expect_error(
date_source(
dataset_name = "ae",
date = ASTDTM,
preserve = TRUE
),
paste(
"The `preserve` argument of `date_source\\(\\)` .* deprecated .* admiral 0.8.0.*",
"Please use `derive_vars_dtm\\(\\)` to convert DTC variables to datetime variables in the dataset.", # nolint
sep = "\n"
)
class = "lifecycle_error_deprecated"
)
})

test_that("derive_var_agegr_ema Test 1: A warning is issued if `derive_var_agegr_ema()` is called", { # nolint
with_options(lifecycle_verbosity = "warning", {
## Test 14: A warning is issued if `derive_var_agegr_ema()` is called ----
test_that("deprecation Test 14: A warning is issued if `derive_var_agegr_ema()`
is called", {
rlang::with_options(lifecycle_verbosity = "warning", {
expect_warning(
derive_var_agegr_ema(admiral_dm, age_var = AGE, new_var = AGEGR1),
"deprecated",
fixed = TRUE
derive_var_agegr_ema(admiral.test::admiral_dm, age_var = AGE, new_var = AGEGR1),
class = "lifecycle_warning_deprecated"
)
})
})

test_that("derive_var_agegr_fda Test 1: A warning is issued if `derive_var_agegr_fda()` is called", { # nolint
with_options(lifecycle_verbosity = "warning", {
## Test 15: A warning is issued if `derive_var_agegr_fda()` is called ----
test_that("deprecation Test 15: A warning is issued if `derive_var_agegr_fda()`
is called", {
rlang::with_options(lifecycle_verbosity = "warning", {
expect_warning(
derive_var_agegr_fda(admiral_dm, age_var = AGE, new_var = AGEGR1),
"deprecated",
fixed = TRUE
derive_var_agegr_fda(admiral.test::admiral_dm, age_var = AGE, new_var = AGEGR1),
class = "lifecycle_warning_deprecated"
)
})
})

0 comments on commit 5129b2e

Please sign in to comment.