@@ -23,6 +23,7 @@ test_that("super_learner_helpers work as intended", {
2323})
2424
2525test_that(" cv_random_schema produces good splits" , {
26+ withr :: local_seed(20260105 )
2627 # produce synthetic data
2728 df <- data.frame (id = 1 : 100 ,
2829 x = sample.int(n = 100 , size = 100 , replace = FALSE ))
@@ -63,12 +64,15 @@ test_that("cv_random_schema produces good splits", {
6364
6465 # the validation data splits should not be far from nrow(df) / n_folds in size
6566 expect_true(
66- all(validation_data_sizes > = nrow(df ) / n_folds - 3 ) &
67- all(validation_data_sizes < = nrow(df ) / n_folds + 3 )
68- )
67+ all(validation_data_sizes > = nrow(df ) / n_folds - 3 ),
68+ info = paste(" validation sizes:" , paste(validation_data_sizes , collapse = " , " )))
69+ expect_true(all(validation_data_sizes < = nrow(df ) / n_folds + 3 ),
70+ info = paste(" validation sizes:" , paste(validation_data_sizes , collapse = " , " )))
6971 # the training data splits should not be far from nrow(df) * (n_folds - 1) / n_folds in size
7072 expect_true(
71- all(training_data_sizes > = nrow(df ) * (n_folds - 1 )/ n_folds - 3 ) &
72- all(training_data_sizes < = nrow(df ) * (n_folds - 1 )/ n_folds + 3 )
73+ all(training_data_sizes > = nrow(df ) * (n_folds - 1 )/ n_folds - 3 ),
74+ info = paste(" training sizes:" , paste(training_data_sizes , collapse = " , " )))
75+ expect_true(all(training_data_sizes < = nrow(df ) * (n_folds - 1 )/ n_folds + 3 ),
76+ info = paste(" training sizes:" , paste(training_data_sizes , collapse = " , " ))
7377 )
7478})
0 commit comments