Skip to content

Commit

Permalink
Test simple example for tundraContainer train.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertzk committed Aug 2, 2015
1 parent 2404873 commit 4cf3a25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/tundraContainer-train.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ train <- function(dataframe, train_args = list(), verbose = FALSE, munge = TRUE)
force(munge)

private$run_hooks("train_pre_munge")
if (isTRUE(munge) && length(munge_procedure) > 0) {
if (isTRUE(munge) && length(self$.munge_procedure) > 0) {
dataframe <- munge(dataframe, self$.munge_procedure, verbose)
attr(dataframe, "mungepieces") <- NULL
}
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-train.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
context("tundraContainer$train")

test_that("it can train a simple example", {
container <- tundraContainer$new("foo", function(data) {
output$data <- data
})

container$train(iris)
expect_identical(container$.output$data, iris)
})

0 comments on commit 4cf3a25

Please sign in to comment.