Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Nov 8, 2023
1 parent 8e6d7d8 commit 7935005
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,7 @@ test_that("lightgbm() accepts 'weight' and 'weights'", {
expect_equal(record_evals[["valid"]][["auc"]][["eval_err"]], list())
}

.train_for_verbosity_test <- function(train_function, verbose_kwarg, verbose_param) {
.train_for_verbosity_test <- function(train_function, verbose_kwarg, verbose_param, print_metrics = FALSE) {
set.seed(708L)
nrounds <- 5L
params <- list(
Expand Down Expand Up @@ -3301,6 +3301,7 @@ test_that("lightgbm() accepts 'weight' and 'weights'", {
)
train_kwargs[["nfold"]] <- 3L
train_kwargs[["showsd"]] <- FALSE
train_kwargs[["print_metrics"]] <- print_metrics
}
log_txt <- capture.output({
bst <- do.call(
Expand Down Expand Up @@ -3549,6 +3550,7 @@ test_that("lgb.cv() only prints eval metrics when expected to", {
out <- .train_for_verbosity_test(
verbose_kwarg = verbose_keyword_arg
, verbose_param = -1L
, print_metrics = FALSE
, train_function = lgb.cv
)
.assert_has_expected_logs(
Expand Down Expand Up @@ -3583,6 +3585,7 @@ test_that("lgb.cv() only prints eval metrics when expected to", {
out <- .train_for_verbosity_test(
verbose_kwarg = verbose_keyword_arg
, verbose_param = 1L
, print_metrics = TRUE
, train_function = lgb.cv
)
.assert_has_expected_logs(
Expand Down Expand Up @@ -3638,6 +3641,7 @@ test_that("lgb.cv() only prints eval metrics when expected to", {
out <- .train_for_verbosity_test(
verbose_kwarg = verbose_keyword_arg
, verbose_param = 1L
, print_metrics = TRUE
, train_function = lgb.cv
)
.assert_has_expected_logs(
Expand Down

0 comments on commit 7935005

Please sign in to comment.