1
- test_that(" Booster$finalize() should not fail" , {
1
+ test_that(" Booster's finalizer should not fail" , {
2
2
X <- as.matrix(as.integer(iris [, " Species" ]), ncol = 1L )
3
3
y <- iris [[" Sepal.Length" ]]
4
4
dtrain <- lgb.Dataset(X , label = y )
@@ -15,11 +15,11 @@ test_that("Booster$finalize() should not fail", {
15
15
16
16
expect_false(.is_null_handle(bst $ .__enclos_env__ $ private $ handle ))
17
17
18
- bst $ finalize()
18
+ bst $ .__enclos_env__ $ private $ finalize()
19
19
expect_true(.is_null_handle(bst $ .__enclos_env__ $ private $ handle ))
20
20
21
21
# calling finalize() a second time shouldn't cause any issues
22
- bst $ finalize()
22
+ bst $ .__enclos_env__ $ private $ finalize()
23
23
expect_true(.is_null_handle(bst $ .__enclos_env__ $ private $ handle ))
24
24
})
25
25
@@ -195,7 +195,7 @@ test_that("Loading a Booster from a text file works", {
195
195
lgb.save(bst , model_file )
196
196
197
197
# finalize the booster and destroy it so you know we aren't cheating
198
- bst $ finalize()
198
+ bst $ .__enclos_env__ $ private $ finalize()
199
199
expect_null(bst $ .__enclos_env__ $ private $ handle )
200
200
rm(bst )
201
201
@@ -238,7 +238,7 @@ test_that("boosters with linear models at leaves can be written to text file and
238
238
preds <- predict(bst , X )
239
239
model_file <- tempfile(fileext = " .model" )
240
240
lgb.save(bst , model_file )
241
- bst $ finalize()
241
+ bst $ .__enclos_env__ $ private $ finalize()
242
242
expect_null(bst $ .__enclos_env__ $ private $ handle )
243
243
rm(bst )
244
244
@@ -275,7 +275,7 @@ test_that("Loading a Booster from a string works", {
275
275
model_string <- bst $ save_model_to_string()
276
276
277
277
# finalize the booster and destroy it so you know we aren't cheating
278
- bst $ finalize()
278
+ bst $ .__enclos_env__ $ private $ finalize()
279
279
expect_null(bst $ .__enclos_env__ $ private $ handle )
280
280
rm(bst )
281
281
@@ -313,7 +313,7 @@ test_that("Saving a large model to string should work", {
313
313
expect_gt(nchar(model_string ), 1024L * 1024L )
314
314
315
315
# finalize the booster and destroy it so you know we aren't cheating
316
- bst $ finalize()
316
+ bst $ .__enclos_env__ $ private $ finalize()
317
317
expect_null(bst $ .__enclos_env__ $ private $ handle )
318
318
rm(bst )
319
319
@@ -383,7 +383,7 @@ test_that("If a string and a file are both passed to lgb.load() the file is used
383
383
lgb.save(bst , model_file )
384
384
385
385
# finalize the booster and destroy it so you know we aren't cheating
386
- bst $ finalize()
386
+ bst $ .__enclos_env__ $ private $ finalize()
387
387
expect_null(bst $ .__enclos_env__ $ private $ handle )
388
388
rm(bst )
389
389
@@ -1508,7 +1508,7 @@ test_that("boosters with linear models at leaves can be written to RDS and re-lo
1508
1508
preds <- predict(bst , X )
1509
1509
model_file <- tempfile(fileext = " .rds" )
1510
1510
saveRDS(bst , file = model_file )
1511
- bst $ finalize()
1511
+ bst $ .__enclos_env__ $ private $ finalize()
1512
1512
expect_null(bst $ .__enclos_env__ $ private $ handle )
1513
1513
rm(bst )
1514
1514
@@ -1562,7 +1562,7 @@ test_that("Booster's print, show, and summary work correctly", {
1562
1562
.has_expected_content_for_fitted_model(log_txt )
1563
1563
1564
1564
# --- should not fail for finalized models ---#
1565
- model $ finalize()
1565
+ model $ .__enclos_env__ $ private $ finalize()
1566
1566
1567
1567
# print()
1568
1568
log_txt <- capture.output({
0 commit comments