Skip to content

Commit

Permalink
[R-package] fix warnings in unit tests (#4225)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Apr 26, 2021
1 parent b6c71e5 commit 5014f19
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -1582,9 +1582,6 @@ test_that("If first_metric_only is TRUE, lgb.cv() decides to stop early based on
, data = DTRAIN_RANDOM_REGRESSION
, nfold = nfolds
, nrounds = nrounds
, valids = list(
"valid1" = DVALID_RANDOM_REGRESSION
)
, eval = list(
.increasing_metric
, .constant_metric
Expand Down Expand Up @@ -1641,9 +1638,6 @@ test_that("early stopping works with lgb.cv()", {
, data = DTRAIN_RANDOM_REGRESSION
, nfold = nfolds
, nrounds = nrounds
, valids = list(
"valid1" = DVALID_RANDOM_REGRESSION
)
, eval = list(
.constant_metric
, .increasing_metric
Expand Down Expand Up @@ -1841,15 +1835,16 @@ test_that("lgb.train() works with linear learners, bagging, and a Dataset that h
test_that("lgb.train() works with linear learners and data where a feature has only 1 non-NA value", {
set.seed(708L)
.new_dataset <- function() {
values <- rep(NA_real_, 100L)
values[18L] <- rnorm(1L)
values <- c(rnorm(100L), rep(NA_real_, 100L))
values[118L] <- rnorm(1L)
X <- matrix(
data = values
, ncol = 1L
, ncol = 2L
)
return(lgb.Dataset(
data = X
, label = 2L * X + runif(nrow(X), 0L, 0.1)
, label = 2L * X[, 1L] + runif(nrow(X), 0L, 0.1)
, feature_pre_filter = FALSE
))
}

Expand Down Expand Up @@ -1888,7 +1883,7 @@ test_that("lgb.train() works with linear learners when Dataset has categorical f
, metric = "mse"
, seed = 0L
, num_leaves = 2L
, categorical_features = 1L
, categorical_feature = 1L
)

dtrain <- .new_dataset()
Expand Down

0 comments on commit 5014f19

Please sign in to comment.