Unverified Commit 651375d5 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] added test on uncovered line of lgb.plot.importance() (#2903)

parent 3e540eac
...@@ -17,11 +17,20 @@ test_that("lgb.plot.importance() should run without error for well-formed inputs ...@@ -17,11 +17,20 @@ test_that("lgb.plot.importance() should run without error for well-formed inputs
# Check that there are no plots present before plotting # Check that there are no plots present before plotting
expect_null(dev.list()) expect_null(dev.list())
resDT <- lgb.plot.importance(
tree_imp = tree_imp args_no_cex <- list(
"tree_imp" = tree_imp
, top_n = 10L , top_n = 10L
, measure = "Gain" , measure = "Gain"
, cex = 0.75 )
args_cex <- args_no_cex
args_cex[["cex"]] <- 0.75
for (arg_list in list(args_no_cex, args_cex)) {
resDT <- do.call(
what = lgb.plot.importance
, args = arg_list
) )
# Check that lgb.plot.importance() returns the data.table of the plotted data # Check that lgb.plot.importance() returns the data.table of the plotted data
...@@ -34,4 +43,5 @@ test_that("lgb.plot.importance() should run without error for well-formed inputs ...@@ -34,4 +43,5 @@ test_that("lgb.plot.importance() should run without error for well-formed inputs
# remove all plots # remove all plots
dev.off() dev.off()
expect_null(dev.list()) expect_null(dev.list())
}
}) })
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment