Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert check to assert #795

Merged
merged 8 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
#' NOTE: teal does not guarantee reproducibility of the code when names of the list elements
#' do not match the original object names. To ensure reproducibility please use [teal.data::teal_data()]
#' or [teal.data::cdisc_data()] with `check = TRUE` enabled.
#' @param modules (`list` or `teal_modules`)\cr
#' nested list of `teal_modules` or `module` objects. See [modules()] and [module()] for
#' @param modules (`list`, `teal_modules` or `teal_module`)\cr
#' nested list of `teal_modules` or `teal_module` objects or a single
#' `teal_modules` or `teal_module` object. These are the specific output modules which
#' will be displayed in the teal application. See [modules()] and [module()] for
#' more details.
#' @param title (`NULL` or `character`)\cr
#' The browser window title (defaults to the host URL of the page).
Expand Down Expand Up @@ -161,16 +163,14 @@ init <- function(data,

checkmate::assert_string(title, null.ok = TRUE)
checkmate::assert_class(data, "TealData")
checkmate::assert_multi_class(modules, c("teal_module", "list", "teal_modules"))
checkmate::check_list(modules)
checkmate::check_class(modules, "teal_modules")
checkmate::assert_list(filter, min.len = 0, names = "unique")
checkmate::assert_subset(names(filter), choices = teal.data::get_dataname(data))
checkmate::assert_character(id, max.len = 1, any.missing = FALSE)

teal.logger::log_system_info()

if (is(modules, "teal_module")) {
modules <- teal::modules(modules)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm you reverted my changes - was that intentional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope - whoops

if (is(modules, "list")) {
modules <- do.call(teal::modules, modules)
}
Expand Down
3 changes: 3 additions & 0 deletions R/module_teal_with_splash.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ ui_teal_with_splash <- function(id,
#' Please also refer to the doc of [init()].
#'
#' @inheritParams init
#' @param modules `teal_modules` object containing the output modules which
#' will be displayed in the teal application. See [modules()] and [module()] for
#' more details.
#' @inheritParams shiny::moduleServer
#' @return `reactive`, return value of [srv_teal()]
#' @export
Expand Down
6 changes: 4 additions & 2 deletions man/init.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/modules_depth.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/srv_nested_tabs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/srv_tabs_with_filters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/srv_teal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/srv_teal_with_splash.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/ui_nested_tabs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/ui_tabs_with_filters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.