|
1 | 1 | library(testthat) |
2 | | -context("descriptor variables") |
3 | 2 | library(parsnip) |
4 | 3 |
|
| 4 | +# ------------------------------------------------------------------------------ |
| 5 | + |
| 6 | +context("descriptor variables") |
| 7 | + |
| 8 | +# ------------------------------------------------------------------------------ |
| 9 | + |
5 | 10 | template <- function(col, pred, ob, lev, fact, dat, x, y) { |
6 | 11 | lst <- list(.n_cols = col, .n_preds = pred, .n_obs = ob, |
7 | 12 | .n_levs = lev, .n_facts = fact, .dat = dat, |
@@ -40,34 +45,34 @@ test_that("requires_descrs", { |
40 | 45 | } |
41 | 46 |
|
42 | 47 | # core args |
43 | | - expect_false(requires_descrs(rand_forest())) |
44 | | - expect_false(requires_descrs(rand_forest(mtry = 3))) |
45 | | - expect_false(requires_descrs(rand_forest(mtry = varying()))) |
46 | | - expect_true(requires_descrs(rand_forest(mtry = .n_cols()))) |
47 | | - expect_false(requires_descrs(rand_forest(mtry = expr(3)))) |
48 | | - expect_false(requires_descrs(rand_forest(mtry = quote(3)))) |
49 | | - expect_true(requires_descrs(rand_forest(mtry = fn()))) |
50 | | - expect_true(requires_descrs(rand_forest(mtry = fn2()))) |
| 48 | + expect_false(parsnip:::requires_descrs(rand_forest())) |
| 49 | + expect_false(parsnip:::requires_descrs(rand_forest(mtry = 3))) |
| 50 | + expect_false(parsnip:::requires_descrs(rand_forest(mtry = varying()))) |
| 51 | + expect_true(parsnip:::requires_descrs(rand_forest(mtry = .n_cols()))) |
| 52 | + expect_false(parsnip:::requires_descrs(rand_forest(mtry = expr(3)))) |
| 53 | + expect_false(parsnip:::requires_descrs(rand_forest(mtry = quote(3)))) |
| 54 | + expect_true(parsnip:::requires_descrs(rand_forest(mtry = fn()))) |
| 55 | + expect_true(parsnip:::requires_descrs(rand_forest(mtry = fn2()))) |
51 | 56 |
|
52 | 57 | # descriptors in `others` |
53 | | - expect_false(requires_descrs(rand_forest(arrrg = 3))) |
54 | | - expect_false(requires_descrs(rand_forest(arrrg = varying()))) |
55 | | - expect_true(requires_descrs(rand_forest(arrrg = .n_obs()))) |
56 | | - expect_false(requires_descrs(rand_forest(arrrg = expr(3)))) |
57 | | - expect_true(requires_descrs(rand_forest(arrrg = fn()))) |
58 | | - expect_true(requires_descrs(rand_forest(arrrg = fn2()))) |
| 58 | + expect_false(parsnip:::requires_descrs(rand_forest(arrrg = 3))) |
| 59 | + expect_false(parsnip:::requires_descrs(rand_forest(arrrg = varying()))) |
| 60 | + expect_true(parsnip:::requires_descrs(rand_forest(arrrg = .n_obs()))) |
| 61 | + expect_false(parsnip:::requires_descrs(rand_forest(arrrg = expr(3)))) |
| 62 | + expect_true(parsnip:::requires_descrs(rand_forest(arrrg = fn()))) |
| 63 | + expect_true(parsnip:::requires_descrs(rand_forest(arrrg = fn2()))) |
59 | 64 |
|
60 | 65 | # mixed |
61 | 66 | expect_true( |
62 | | - requires_descrs( |
| 67 | + parsnip:::requires_descrs( |
63 | 68 | rand_forest( |
64 | 69 | mtry = 3, |
65 | 70 | arrrg = fn2()) |
66 | 71 | ) |
67 | 72 | ) |
68 | 73 |
|
69 | 74 | expect_true( |
70 | | - requires_descrs( |
| 75 | + parsnip:::requires_descrs( |
71 | 76 | rand_forest( |
72 | 77 | mtry = .n_cols(), |
73 | 78 | arrrg = 3) |
|
0 commit comments