Skip to content

Commit

Permalink
Merge pull request #215 from tidymodels/obj-sum-split
Browse files Browse the repository at this point in the history
rsplit obj_sum changes for r-lib/pillar#240 as well as #214
  • Loading branch information
topepo authored Feb 2, 2021
2 parents ae94bbc + 0facc13 commit 54e3235
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

* A few internal functions were exported so that `rsample`-adjacent packages can use the same underlying code.

* The `obj_sum()` method for `rsplit` objects was updated.

# rsample 0.0.8

Expand Down
2 changes: 1 addition & 1 deletion R/rsplit.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ obj_sum.rsplit <- function(x, ...) {
else
paste(length(x$out_id))

paste0("rsplit [",
paste0("split [",
length(x$in_id), "/",
out_char, "]")
}
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/print_test_output/obj_sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
> set.seed(233)
> print(validation_split(mtcars))
# Validation Set Split (0.75/0.25)
# A tibble: 1 x 2
splits id
<list> <chr>
1 <split [24/8]> validation

4 changes: 4 additions & 0 deletions tests/testthat/test_rsplit.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ test_that('print methods', {
set.seed(233)
print(validation_split(mtcars)$splits[[1]])
})
verify_output(test_path("print_test_output", "obj_sum"), {
set.seed(233)
print(validation_split(mtcars))
})
})


Expand Down

0 comments on commit 54e3235

Please sign in to comment.