diff --git a/NEWS.md b/NEWS.md index 3819e4524..c6d9c626e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,10 @@ - do not allow to set a dataset name that do not exist in `teal_data` environment. - `teal_data` no longer set default `datanames()` based on `join_keys` names - it uses only data names. +### Miscellaneous + +- `get_code` no longer adds `warning` message about failed verification. + # teal.data 0.6.0 ### Enhancements diff --git a/R/teal_data-get_code.R b/R/teal_data-get_code.R index 64443fa6a..d74435bd6 100644 --- a/R/teal_data-get_code.R +++ b/R/teal_data-get_code.R @@ -4,7 +4,6 @@ #' #' Retrieve code stored in `@code`, which (in principle) can be used to recreate all objects found in `@env`. #' Use `datanames` to limit the code to one or more of the datasets enumerated in `@datanames`. -#' If the code has not passed verification (with [`verify()`]), a warning will be prepended. #' #' @section Extracting dataset-specific code: #' When `datanames` is specified, the code returned will be limited to the lines needed to _create_ @@ -114,10 +113,6 @@ setMethod("get_code", signature = "teal_data", definition = function(object, dep object@code } - if (!object@verified) { - code <- c("warning('Code was not verified for reproducibility.')", code) - } - if (deparse) { if (length(code) == 0) { code diff --git a/man/get_code.Rd b/man/get_code.Rd index a72c7b0c8..29b3a4134 100644 --- a/man/get_code.Rd +++ b/man/get_code.Rd @@ -29,7 +29,6 @@ Retrieve code from \code{teal_data} object. \details{ Retrieve code stored in \verb{@code}, which (in principle) can be used to recreate all objects found in \verb{@env}. Use \code{datanames} to limit the code to one or more of the datasets enumerated in \verb{@datanames}. -If the code has not passed verification (with \code{\link[=verify]{verify()}}), a warning will be prepended. } \section{Extracting dataset-specific code}{ diff --git a/tests/testthat/test-get_code.R b/tests/testthat/test-get_code.R index 7273ca3f6..40095f1bc 100644 --- a/tests/testthat/test-get_code.R +++ b/tests/testthat/test-get_code.R @@ -1,13 +1,11 @@ -warning_message <- "warning('Code was not verified for reproducibility.')" - testthat::test_that("handles empty @code slot", { testthat::expect_identical( get_code(teal_data(a = 1, code = character(0)), datanames = "a"), - warning_message + character(0) ) testthat::expect_identical( get_code(teal_data(a = 1, code = ""), datanames = "a"), - paste0(warning_message, "\n") + "" ) }) @@ -20,7 +18,7 @@ testthat::test_that("handles the code without symbols on rhs", { testthat::expect_identical( get_code(teal_data(a = 5, code = code), datanames = "a"), - paste(warning_message, "a <- 5", sep = "\n") + "a <- 5" ) }) @@ -29,7 +27,7 @@ testthat::test_that("handles the code included in curly brackets", { testthat::expect_identical( get_code(teal_data(a = 5, code = code), datanames = "a"), - paste(warning_message, "a <- 5", sep = "\n") + "a <- 5" ) }) @@ -545,11 +543,7 @@ testthat::test_that("detects occurrence of a function definition with a @linksto tdata <- teal_data(code = code) testthat::expect_identical( get_code(tdata, datanames = "x"), - paste( - warning_message, - "foo <- function() {\n env <- parent.frame()\n env$x <- 0\n}\nfoo()", - sep = "\n" - ) + "foo <- function() {\n env <- parent.frame()\n env$x <- 0\n}\nfoo()" ) }) # $ --------------------------------------------------------------------------------------------------------------- @@ -608,7 +602,6 @@ testthat::test_that("understands @ usage and do not treat rhs of @ as objects (o testthat::expect_identical( get_code(tdata, datanames = "x"), paste( - warning_message, 'setClass("aclass", slots = c(a = "numeric", x = "numeric", y = "numeric"))', 'x <- new("aclass", a = 1:3, x = 1:3, y = 1:3)', sep = "\n" @@ -617,7 +610,6 @@ testthat::test_that("understands @ usage and do not treat rhs of @ as objects (o testthat::expect_identical( get_code(tdata, datanames = "a"), paste( - warning_message, 'setClass("aclass", slots = c(a = "numeric", x = "numeric", y = "numeric"))', 'x <- new("aclass", a = 1:3, x = 1:3, y = 1:3)', 'a <- new("aclass", a = 1:3, x = 1:3, y = 1:3)', @@ -646,7 +638,6 @@ testthat::test_that("library() and require() are always returned", { testthat::expect_identical( get_code(tdata, datanames = "x"), paste( - warning_message, "library(random.cdisc.data)", "require(dplyr)", "library(MultiAssayExperiment)", @@ -672,7 +663,6 @@ testthat::test_that("data() call is returned when data name is provided as is", testthat::expect_identical( get_code(tdata, datanames = "x"), paste( - warning_message, "library(random.cdisc.data)", "require(dplyr)", "library(MultiAssayExperiment)", @@ -696,7 +686,6 @@ testthat::test_that("data() call is returned when data name is provided as a cha testthat::expect_identical( get_code(tdata, datanames = "z"), paste( - warning_message, "library(random.cdisc.data)", "require(dplyr)", "library(MultiAssayExperiment)", diff --git a/vignettes/teal-data-reproducibility.Rmd b/vignettes/teal-data-reproducibility.Rmd index c37a9ed66..10f08d583 100644 --- a/vignettes/teal-data-reproducibility.Rmd +++ b/vignettes/teal-data-reproducibility.Rmd @@ -45,7 +45,6 @@ data_with_data <- teal_data(i = head(iris), code = "i <- head(iris)") data_with_data # is unverified data_with_data <- within(data_with_data, i$rand <- sample(nrow(i))) data_with_data # remains unverified -cat(get_code(data_with_data)) # warning is prepended ``` ### Verification process @@ -69,7 +68,7 @@ data_right <- teal_data( data <- data.frame(x = 11:20) data$id <- seq_len(nrow(data)) }) -) +) # is unverified (data_right_verified <- verify(data_right)) # returns verified object ```