Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 6, 2024
1 parent ae0b7d2 commit d17543d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/testthat/test-format_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,20 @@ withr::with_options(
"e42dep [2] * c12hour"
)
})

test_that("format_parameters, cut", {
data(mtcars)
mtcars$grp <- cut(mtcars$mpg, breaks = c(0, 15, 20, 50))
out <- model_parameters(lm(wt ~ grp, data = mtcars))
expect_equal(
attributes(out)$pretty_names,
c(
`(Intercept)` = "(Intercept)", `grp(15,20]` = "grp [>15-20]",
`grp(20,50]` = "grp [>20-50]"
),
ignore_attr = TRUE
)
expect_identical(out$Parameter, c("(Intercept)", "grp(15,20]", "grp(20,50]"))
})
}
)

0 comments on commit d17543d

Please sign in to comment.