diff --git a/R/mlp.R b/R/mlp.R index ee40edbd9..d04bca2ef 100644 --- a/R/mlp.R +++ b/R/mlp.R @@ -196,7 +196,8 @@ keras_mlp <- good_activation <- activation %in% allowed_keras_activation if (!all(good_activation)) { cli::cli_abort( - "{.arg activation} should be one of: {allowed_activation}." + "{.arg activation} should be one of: {allowed_keras_activation}, not + {.val {activation}}." ) } diff --git a/tests/testthat/test-mlp_keras.R b/tests/testthat/test-mlp_keras.R index 640ac2098..8581a2530 100644 --- a/tests/testthat/test-mlp_keras.R +++ b/tests/testthat/test-mlp_keras.R @@ -275,4 +275,11 @@ test_that('all keras activation functions', { keras::backend()$clear_session() } + expect_snapshot( + error = TRUE, + mlp(mode = "classification", hidden_units = 2, penalty = 0.01, epochs = 2, + activation = "invalid") %>% + set_engine("keras", verbose = 0) %>% + parsnip::fit(Class ~ A + B, data = modeldata::two_class_dat) + ) })