From 21bf40c0f6934a5476ac05eb6ed6143b33dd8afa Mon Sep 17 00:00:00 2001 From: Daniel Sjoberg Date: Mon, 6 May 2024 11:46:37 -0700 Subject: [PATCH] styler --- R/construction_helpers.R | 4 +++- tests/testthat/test-construction_helpers.R | 26 ++++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/R/construction_helpers.R b/R/construction_helpers.R index c322324fe..52b867052 100644 --- a/R/construction_helpers.R +++ b/R/construction_helpers.R @@ -118,7 +118,9 @@ construct_model.survey.design <- function(x, formula, method, method.args = list .as_list_of_exprs <- function(x) { x_enexpr <- enexpr(x) - if (tryCatch(inherits(x, "list"), error = \(x) FALSE)) return(x) + if (tryCatch(inherits(x, "list"), error = \(x) FALSE)) { + return(x) + } call_args(x_enexpr) } diff --git a/tests/testthat/test-construction_helpers.R b/tests/testthat/test-construction_helpers.R index e21008916..8efbdb0bf 100644 --- a/tests/testthat/test-construction_helpers.R +++ b/tests/testthat/test-construction_helpers.R @@ -30,20 +30,22 @@ test_that("construct_model() works", { "cannot be namespaced" ) - expect_equal({ - outside_fun <- function() { - method.args <- list() + expect_equal( + { + outside_fun <- function() { + method.args <- list() - construct_model.data.frame( - mtcars, - formula = mpg ~ cyl, - method = "lm", - method.args = method.args - ) |> - coef() - } + construct_model.data.frame( + mtcars, + formula = mpg ~ cyl, + method = "lm", + method.args = method.args + ) |> + coef() + } - outside_fun()}, + outside_fun() + }, lm(mpg ~ cyl, mtcars) |> coef() )