"E2E: Functional spec (classification) works"
"E2E: Functional spec tuning (including repetition) works"
"E2E: Multi-input, single-output functional classification works"
"E2E: Functional spec with pre-constructed optimizer works"
"E2E: Functional spec with string loss works"

E2E: Functional spec (classification) works

Error in `eval(code, test_env)`: object 'fit_obj' not found

Error in `estimate_tune_results(x)`: All models failed. Run `show_notes(.Last.tune.result)` for more information.

E2E: Functional spec tuning (including repetition) works

Expected `fit_obj <- parsnip::fit(wf, data = train_df)` to run without any errors.
i Actually got a <simpleError> with text:
  ModuleNotFoundError: No module named 'keras'
  Run `reticulate::py_last_error()` for details.

E2E: Multi-input, single-output functional classification works

E2E: Functional spec with pre-constructed optimizer works

E2E: Functional spec with string loss works

test_that("E2E: Functional spec (regression) works", {
path_block <- function(tensor, units = 8) {
output_block_reg <- function(tensor) keras3::layer_dense(tensor, units = 1)
preds <- predict(fit_obj, new_data = data[1:5, ])
test_that("E2E: Functional regression works with named predictors in formula", {
# Use named predictors to cover the x <- data[, x_names, drop = FALSE] line
fit_obj <- fit(spec, mpg ~ cyl + disp, data = data)
test_that("E2E: Block repetition works for functional models", {
dense_block <- function(tensor, units = 8) {
output_block <- function(tensor) keras3::layer_dense(tensor, units = 1)
spec_1 <- e2e_func_repeat(num_dense_path = 1, fit_epochs = 1) |>
fit_1 <- fit(spec_1, mpg ~ ., data = mtcars)
spec_2 <- e2e_func_repeat(num_dense_path = 2, fit_epochs = 1) |>
fit_2 <- fit(spec_2, mpg ~ ., data = mtcars)
# Expect 4 layers: Input, Dense, Dense, Output
spec_3 <- e2e_func_repeat(num_dense_path = 0, fit_epochs = 1) |>
fit_3 <- fit(spec_3, mpg ~ ., data = mtcars)
test_that("E2E: Multi-input, multi-output functional regression works", {
layer_input(shape = input_shape, name = "input_1")
layer_input(shape = input_shape, name = "input_2")
layer_dense(tensor, units = 1, name = "output_1")
layer_dense(tensor, units = 1, name = "output_2")
spec <- multi_in_out_reg(fit_epochs = 2) |> set_engine("keras")
rec <- recipe(output_1 + output_2 ~ input_a + input_b, data = train_df)