Skip to content

Commit 2034a3f

Browse files
committed
remove some warnings in tests
1 parent 28d7ace commit 2034a3f

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

tests/testthat/test_boost_tree.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ test_that('updating', {
120120
test_that('bad input', {
121121
expect_error(boost_tree(mode = "bogus"))
122122
expect_error({
123-
bt <- boost_tree(trees = -1)
124-
fit(bt, Species ~ ., iris) %>% set_engine("xgboost")
123+
bt <- boost_tree(trees = -1) %>% set_engine("xgboost")
124+
fit(bt, Species ~ ., iris)
125125
})
126126
expect_error({
127-
bt <- boost_tree(min_n = -10)
128-
fit(bt, Species ~ ., iris) %>% set_engine("xgboost")
127+
bt <- boost_tree(min_n = -10) %>% set_engine("xgboost")
128+
fit(bt, Species ~ ., iris)
129129
})
130130
expect_message(translate(boost_tree(mode = "classification"), engine = NULL))
131131
expect_error(translate(boost_tree(formula = y ~ x)))

tests/testthat/test_decision_tree.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ test_that('updating', {
110110
test_that('bad input', {
111111
expect_error(decision_tree(mode = "bogus"))
112112
expect_error({
113-
bt <- decision_tree(cost_complexity = -1)
114-
fit(bt, Species ~ ., iris) %>% set_engine("rpart")
113+
bt <- decision_tree(cost_complexity = -1) %>% set_engine("rpart")
114+
fit(bt, Species ~ ., iris)
115115
})
116116
expect_error({
117-
bt <- decision_tree(min_n = 0)
118-
fit(bt, Species ~ ., iris) %>% set_engine("rpart")
117+
bt <- decision_tree(min_n = 0) %>% set_engine("rpart")
118+
fit(bt, Species ~ ., iris)
119119
})
120120
expect_error(translate(decision_tree(), engine = NULL))
121121
expect_error(translate(decision_tree(formula = y ~ x)))

tests/testthat/test_linear_reg_keras.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ test_that('regression prediction', {
101101
)
102102

103103
keras_pred <-
104-
predict(lm_fit$fit, as.matrix(iris[1:3,2:4])) %>%
105-
as_tibble() %>%
106-
setNames(".pred")
104+
predict(lm_fit$fit, as.matrix(iris[1:3,2:4]))
105+
colnames(keras_pred) <- ".pred"
106+
107+
keras_pred <-
108+
keras_pred %>%
109+
as_tibble()
107110
parsnip_pred <- predict(lm_fit, iris[1:3,2:4])
108111
expect_equal(as.data.frame(keras_pred), as.data.frame(parsnip_pred))
109112

0 commit comments

Comments
 (0)