From a7236802906231baa326a6f69de1dfc6de77cea2 Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Thu, 8 Sep 2022 16:20:50 -0400 Subject: [PATCH] fix formatting in `prompt_missing_implementation()` --- R/misc.R | 2 +- tests/testthat/_snaps/fit_interfaces.md | 7 +++++++ tests/testthat/test_fit_interfaces.R | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/R/misc.R b/R/misc.R index ae0358ce4..bceb2f9e2 100644 --- a/R/misc.R +++ b/R/misc.R @@ -183,7 +183,7 @@ prompt_missing_implementation <- function(cls, msg <- c( "!" = "{.pkg parsnip} could not locate an implementation for `{cls}` {mode} \\ model specifications{if (isTRUE(user_specified_engine)) { - ' using the `{engine}` engine' } else {''}}." + paste0(' using the `', engine, '` engine')} else {''}}." ) if (nrow(avail) == 0 && nrow(all) > 0) { diff --git a/tests/testthat/_snaps/fit_interfaces.md b/tests/testthat/_snaps/fit_interfaces.md index 05dc8dcc1..b3f3b70ff 100644 --- a/tests/testthat/_snaps/fit_interfaces.md +++ b/tests/testthat/_snaps/fit_interfaces.md @@ -12,3 +12,10 @@ i Please install (if needed) and load to continue. +--- + + ! parsnip could not locate an implementation for `cubist_rules` model specifications using the `Cubist` engine. + i The parsnip extension package rules implements support for this specification. + i Please install (if needed) and load to continue. + + diff --git a/tests/testthat/test_fit_interfaces.R b/tests/testthat/test_fit_interfaces.R index 27075ef3b..c3d4ab4ce 100644 --- a/tests/testthat/test_fit_interfaces.R +++ b/tests/testthat/test_fit_interfaces.R @@ -109,4 +109,5 @@ test_that('No loaded engines', { ) expect_snapshot_error({cubist_rules() %>% fit(mpg ~., data = mtcars)}) expect_snapshot_error({poisson_reg() %>% fit(mpg ~., data = mtcars)}) + expect_snapshot_error({cubist_rules(engine = "Cubist") %>% fit(mpg ~., data = mtcars)}) })