Skip to content

update to testthat 3e + consolidate translate() tests #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0dc7e88
bump testthat version
simonpcouch Apr 5, 2022
96d2be8
drop calls to `context()`
simonpcouch Apr 5, 2022
80bd6e7
remove usage of `expect_equivalent()`
simonpcouch Apr 6, 2022
fff68e3
favor `expect_equal` args over ad-hoc deattr
simonpcouch Apr 6, 2022
1eacf15
drop calls to `source`, standardize header
simonpcouch Apr 6, 2022
06b8c8f
drop `library` calls, namespace w `::` when needed
simonpcouch Apr 6, 2022
02ac406
drop `new_empty_quosure()`
simonpcouch Apr 6, 2022
c1b9613
add `test_translate` skeleton, spec out with `linear_reg`
simonpcouch Apr 6, 2022
264c1ec
add helper for `expect_snapshot`ting translate `args`
simonpcouch Apr 6, 2022
ffeaa38
adjust layout of `test_translate.R`
simonpcouch Apr 6, 2022
483cf03
condense primary arguments testing
simonpcouch Apr 6, 2022
c8297e2
refactor engine arguments tests
simonpcouch Apr 7, 2022
cc6bb34
`expect_warning` -> `expect_snapshot` when `regex` arg present
simonpcouch Apr 7, 2022
ebeda89
revert cc6bb34
simonpcouch Apr 7, 2022
f318779
`expect_output` -> `expect_snapshot`
simonpcouch Apr 7, 2022
97b9f13
revert to simpler expectation
simonpcouch Apr 7, 2022
3df21e7
add snaps
simonpcouch Apr 7, 2022
e661720
misc bug fixes
simonpcouch Apr 7, 2022
1edd621
adjust helper interface
simonpcouch Apr 7, 2022
553ca9b
make envs reproducible, update snaps
simonpcouch Apr 8, 2022
fd154dd
small `r cmd check` fixes
simonpcouch Apr 8, 2022
67e0ed8
Merge branch 'main' into 3e
simonpcouch Apr 8, 2022
d7b7e1b
typo fix
simonpcouch Apr 8, 2022
1c3eccd
Merge branch '3e' of https://github.com/tidymodels/parsnip into 3e
simonpcouch Apr 8, 2022
e377195
invoke `lung` outside of test body
simonpcouch Apr 11, 2022
b9fb226
load `lung` data conditionally
simonpcouch Apr 11, 2022
3673a4a
transition `$fit` to `extract_fit_*()`
simonpcouch Apr 13, 2022
31df3ed
transition `update()` tests to snapshots
simonpcouch Apr 15, 2022
d16ddbd
transition last bits of `rlang` nastiness to `expect_snapshot()`
simonpcouch Apr 15, 2022
bb2ad5d
revert to `quo` for ignoring env
simonpcouch Apr 15, 2022
2d6d66f
drop outdated snapshot
simonpcouch Apr 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Suggests:
rpart,
sparklyr (>= 1.0.0),
survival,
testthat,
testthat (>= 3.0.0),
xgboost (>= 1.5.0.1)
VignetteBuilder:
knitr
Expand Down Expand Up @@ -89,4 +89,5 @@ Config/rcmdcheck/ignore-inconsequential-notes: true
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
RoxygenNote: 7.1.2.9000
92 changes: 92 additions & 0 deletions tests/testthat/_snaps/boost_tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# updating

Code
expr1 %>% update(trees = 10)
Output
Boosted Tree Model Specification (unknown)

Main Arguments:
trees = 10

Engine-Specific Arguments:
verbose = 0

Computational engine: xgboost


---

Code
expr1 %>% update(param_tibb)
Output
Boosted Tree Model Specification (unknown)

Main Arguments:
mtry = 1
trees = 7

Engine-Specific Arguments:
verbose = 0

Computational engine: xgboost


---

Code
expr1 %>% update(param_list)
Output
Boosted Tree Model Specification (unknown)

Main Arguments:
mtry = 1
trees = 7

Engine-Specific Arguments:
verbose = 0

Computational engine: xgboost


---

Code
expr2 %>% update(bands = 10)
Output
Boosted Tree Model Specification (unknown)

Main Arguments:
trees = tune()

Engine-Specific Arguments:
bands = 10

Computational engine: C5.0


---

Code
expr3 %>% update(trees = 1, fresh = TRUE)
Output
Boosted Tree Model Specification (unknown)

Main Arguments:
trees = 1

Computational engine: xgboost


---

Code
expr4 %>% update(noGlobalPruning = TRUE)
Output
Boosted Tree Model Specification (unknown)

Engine-Specific Arguments:
noGlobalPruning = TRUE

Computational engine: C5.0


79 changes: 79 additions & 0 deletions tests/testthat/_snaps/decision_tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# updating

Code
expr1 %>% update(cost_complexity = 0.1)
Output
Decision Tree Model Specification (unknown)

Main Arguments:
cost_complexity = 0.1

Engine-Specific Arguments:
model = FALSE

Computational engine: rpart


---

Code
expr1 %>% update(param_tibb)
Output
Decision Tree Model Specification (unknown)

Main Arguments:
cost_complexity = 0.1
min_n = 1

Engine-Specific Arguments:
model = FALSE

Computational engine: rpart


---

Code
expr1 %>% update(param_list)
Output
Decision Tree Model Specification (unknown)

Main Arguments:
cost_complexity = 0.1
min_n = 1

Engine-Specific Arguments:
model = FALSE

Computational engine: rpart


---

Code
expr2 %>% update(model = FALSE)
Output
Decision Tree Model Specification (unknown)

Main Arguments:
cost_complexity = tune()

Engine-Specific Arguments:
model = FALSE

Computational engine: rpart


---

Code
expr3 %>% update(cost_complexity = 1, fresh = TRUE)
Output
Decision Tree Model Specification (unknown)

Main Arguments:
cost_complexity = 1

Computational engine: rpart


109 changes: 109 additions & 0 deletions tests/testthat/_snaps/linear_reg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# updating

Code
expr1 %>% update(mixture = 0)
Output
Linear Regression Model Specification (regression)

Main Arguments:
mixture = 0

Engine-Specific Arguments:
model = FALSE

Computational engine: lm


---

Code
expr2 %>% update(nlambda = 10)
Output
Linear Regression Model Specification (regression)

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr3 %>% update(mixture = 1, fresh = TRUE, nlambda = 10)
Output
Linear Regression Model Specification (regression)

Main Arguments:
mixture = 1

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr3 %>% update(nlambda = 10)
Output
Linear Regression Model Specification (regression)

Main Arguments:
penalty = tune()
mixture = 0

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr4 %>% update(param_tibb)
Output
Linear Regression Model Specification (regression)

Main Arguments:
penalty = 1
mixture = 0.333333333333333

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr4 %>% update(param_list)
Output
Linear Regression Model Specification (regression)

Main Arguments:
penalty = 1
mixture = 0.333333333333333

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr5 %>% update(family = "poisson")
Output
Linear Regression Model Specification (regression)

Engine-Specific Arguments:
family = poisson

Computational engine: glm


82 changes: 82 additions & 0 deletions tests/testthat/_snaps/logistic_reg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# updating

Code
expr1 %>% update(mixture = 0)
Output
Logistic Regression Model Specification (classification)

Main Arguments:
mixture = 0

Engine-Specific Arguments:
family = expr(binomial(link = "probit"))

Computational engine: glm


---

Code
expr2 %>% update(nlambda = 10)
Output
Logistic Regression Model Specification (classification)

Main Arguments:
mixture = tune()

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr3 %>% update(mixture = 1, fresh = TRUE, nlambda = 10)
Output
Logistic Regression Model Specification (classification)

Main Arguments:
mixture = 1

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr4 %>% update(param_tibb)
Output
Logistic Regression Model Specification (classification)

Main Arguments:
penalty = 1
mixture = 0.333333333333333

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


---

Code
expr4 %>% update(param_list)
Output
Logistic Regression Model Specification (classification)

Main Arguments:
penalty = 1
mixture = 0.333333333333333

Engine-Specific Arguments:
nlambda = 10

Computational engine: glmnet


Loading