-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from tidymodels/missing-snapshots
Missing snapshots
- Loading branch information
Showing
6 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# `levels` argument is validated | ||
|
||
Code | ||
new_default_formula_blueprint(levels = 1) | ||
Condition | ||
Error in `new_default_formula_blueprint()`: | ||
! `levels` must be a list, not the number 1. | ||
|
||
--- | ||
|
||
Code | ||
new_default_formula_blueprint(levels = list(1)) | ||
Condition | ||
Error in `new_default_formula_blueprint()`: | ||
! `levels` must be fully named. | ||
|
||
--- | ||
|
||
Code | ||
new_default_formula_blueprint(levels = list(a = 1)) | ||
Condition | ||
Error in `new_default_formula_blueprint()`: | ||
! `levels` must only contain character vectors. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# check on input to `new_blueprint()` | ||
|
||
Code | ||
new_blueprint(same_new_arg = 1, same_new_arg = 2) | ||
Condition | ||
Error in `new_blueprint()`: | ||
! All elements of `...` must have unique names. | ||
|
||
# checks for updating a blueprint | ||
|
||
Code | ||
update_blueprint(blueprint, intercept = TRUE, intercept = FALSE) | ||
Condition | ||
Error in `update_blueprint()`: | ||
! `...` must have unique names. | ||
|
||
--- | ||
|
||
Code | ||
update_blueprint(blueprint, intercpt = TRUE) | ||
Condition | ||
Error in `update_blueprint()`: | ||
! All elements of `...` must already exist. | ||
i The following fields are new: "intercpt". | ||
|
||
# checks the ptype | ||
|
||
Code | ||
new_blueprint(ptypes = list(x = 1)) | ||
Condition | ||
Error in `new_blueprint()`: | ||
! `ptypes` must have an element named "predictors". | ||
|
||
--- | ||
|
||
Code | ||
new_blueprint(ptypes = list(predictors = "not a tibble", outcomes = "not a tibble")) | ||
Condition | ||
Error in `new_blueprint()`: | ||
! `ptypes$predictors` must be a tibble, not the string "not a tibble". | ||
|
||
--- | ||
|
||
Code | ||
new_blueprint(ptypes = list(predictors = tibble_too_long, outcomes = tibble_too_long)) | ||
Condition | ||
Error in `new_blueprint()`: | ||
! `ptypes$predictors` must be size 0, not size 1. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# `contr_one_hot()` input checks | ||
|
||
Code | ||
contr_one_hot(n = 1, sparse = TRUE) | ||
Condition | ||
Warning: | ||
`sparse = TRUE` not implemented for `contr_one_hot()`. | ||
Output | ||
1 | ||
1 1 | ||
|
||
--- | ||
|
||
Code | ||
contr_one_hot(n = 1, contrasts = FALSE) | ||
Condition | ||
Warning: | ||
`contrasts = FALSE` not implemented for `contr_one_hot()`. | ||
Output | ||
1 | ||
1 1 | ||
|
||
--- | ||
|
||
Code | ||
contr_one_hot(n = 1:2) | ||
Condition | ||
Error in `contr_one_hot()`: | ||
! `n` must have length 1 when an integer is provided. | ||
|
||
--- | ||
|
||
Code | ||
contr_one_hot(n = list(1:2)) | ||
Condition | ||
Error in `contr_one_hot()`: | ||
! `n` must be a character vector or an integer of size 1. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
test_that("`levels` argument is validated", { | ||
expect_snapshot(error = TRUE, { | ||
new_default_formula_blueprint(levels = 1) | ||
}) | ||
expect_snapshot(error = TRUE, { | ||
new_default_formula_blueprint(levels = list(1)) | ||
}) | ||
expect_snapshot(error = TRUE, { | ||
new_default_formula_blueprint(levels = list("a" = 1)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
test_that("check on input to `new_blueprint()`", { | ||
expect_snapshot(error = TRUE, { | ||
new_blueprint(same_new_arg = 1, same_new_arg = 2) | ||
}) | ||
}) | ||
|
||
test_that("checks for updating a blueprint", { | ||
blueprint <- default_xy_blueprint() | ||
|
||
expect_snapshot(error = TRUE, { | ||
update_blueprint(blueprint, intercept = TRUE, intercept = FALSE) | ||
}) | ||
expect_snapshot(error = TRUE, { | ||
update_blueprint(blueprint, intercpt = TRUE) | ||
}) | ||
}) | ||
|
||
test_that("checks the ptype", { | ||
expect_snapshot(error = TRUE, { | ||
new_blueprint(ptypes = list(x = 1)) | ||
}) | ||
expect_snapshot(error = TRUE, { | ||
new_blueprint(ptypes = list("predictors" = "not a tibble", outcomes = "not a tibble")) | ||
}) | ||
|
||
tibble_too_long <- tibble::tibble(x =1) | ||
expect_snapshot(error = TRUE, { | ||
new_blueprint(ptypes = list("predictors" = tibble_too_long, outcomes = tibble_too_long)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters