Skip to content

Commit

Permalink
styler
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed May 6, 2024
1 parent eab225e commit 21bf40c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion R/construction_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
26 changes: 14 additions & 12 deletions tests/testthat/test-construction_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down

0 comments on commit 21bf40c

Please sign in to comment.