Skip to content

Commit 1aac943

Browse files
committed
small changes
1 parent bf06b9c commit 1aac943

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

R/aaa_models.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ check_fit_info <- function(fit_obj) {
207207
}
208208

209209
exp_interf <- c("data.frame", "formula", "matrix")
210-
if (length(fit_obj$interface) > 1) {
210+
if (length(fit_obj$interface) != 1) {
211211
stop("The `interface` element should have a single value of : ",
212212
paste0("`", exp_interf, "`", collapse = ", "),
213213
call. = FALSE)
214214
}
215-
if (!any(fit_obj$interface == exp_interf)) {
215+
if (!fit_obj$interface %in% exp_interf) {
216216
stop("The `interface` element should have a value of : ",
217217
paste0("`", exp_interf, "`", collapse = ", "),
218218
call. = FALSE)
@@ -285,7 +285,7 @@ set_new_model <- function(model) {
285285
parsnip = character(0),
286286
original = character(0),
287287
func = list(),
288-
has_submodel = rlang::na_lgl
288+
has_submodel = logical(0)
289289
)
290290
current[[paste0(model, "_fit")]] <-
291291
dplyr::tibble(
@@ -472,7 +472,7 @@ set_fit <- function(model, mode, eng, value) {
472472
dplyr::filter(engine == eng & mode == !!mode) %>%
473473
nrow()
474474
if (has_engine != 1) {
475-
stop("set_fit The combination of engine '", eng, "' and mode '",
475+
stop("The combination of engine '", eng, "' and mode '",
476476
mode, "' has not been registered for model '",
477477
model, "'. ", call. = FALSE)
478478
}

tests/testthat/test_registration.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ expect_equal(
4242

4343
test_by_col(
4444
get_from_env("sponge_args"),
45-
tibble(engine = character(0), parsnip = character(0),
46-
original = character(0), func = vector("list"))
45+
dplyr::tibble(engine = character(0), parsnip = character(0),
46+
original = character(0), func = vector("list"),
47+
has_submodel = logical(0))
4748
)
4849

4950
test_by_col(
@@ -149,6 +150,7 @@ test_that('adding a new argument', {
149150
test_by_col(
150151
get_from_env("sponge_args"),
151152
tibble(engine = "gum", parsnip = "modeling", original = "modelling",
153+
func = list(list(pkg = "foo", fun = "bar")),
152154
has_submodel = FALSE)
153155
)
154156

0 commit comments

Comments
 (0)