Skip to content

Commit

Permalink
Merge pull request tidyverse#6133 from tidyverse/snapshot-update
Browse files Browse the repository at this point in the history
Update snapshots with latest rlang
  • Loading branch information
lionel- authored Dec 17, 2021
2 parents 8e52331 + 91e5582 commit 8347e27
Show file tree
Hide file tree
Showing 44 changed files with 786 additions and 574 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Imports:
magrittr (>= 1.5),
methods,
R6,
rlang (>= 0.99.0.9001),
rlang (>= 0.99.0.9003),
tibble (>= 2.1.3),
tidyselect (>= 1.1.1),
utils,
Expand Down
122 changes: 62 additions & 60 deletions tests/testthat/_snaps/across.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,78 @@
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `..1 = across(where(is.numeric), 42)`.
! Problem while computing `..1 = across(where(is.numeric), 42)`.
Caused by error in `across()`:
`.fns` must be NULL, a function, a formula, or a list of functions/formulas.
! `.fns` must be NULL, a function, a formula, or a list of functions/formulas.
Code
(expect_error(tibble(x = 1) %>% summarise(across(y, mean))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `..1 = across(y, mean)`.
! Problem while computing `..1 = across(y, mean)`.
Caused by error in `across()`:
Can't subset columns that don't exist.
x Column `y` doesn't exist.
! Can't subset columns that don't exist.
x Column `y` doesn't exist.
Code
(expect_error(tibble(x = 1) %>% summarise(res = across(where(is.numeric), 42))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `res = across(where(is.numeric), 42)`.
! Problem while computing `res = across(where(is.numeric), 42)`.
Caused by error in `across()`:
`.fns` must be NULL, a function, a formula, or a list of functions/formulas.
! `.fns` must be NULL, a function, a formula, or a list of functions/formulas.
Code
(expect_error(tibble(x = 1) %>% summarise(z = across(y, mean))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `z = across(y, mean)`.
! Problem while computing `z = across(y, mean)`.
Caused by error in `across()`:
Can't subset columns that don't exist.
x Column `y` doesn't exist.
! Can't subset columns that don't exist.
x Column `y` doesn't exist.
Code
(expect_error(tibble(x = 1) %>% summarise(res = sum(if_any(where(is.numeric),
42)))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `res = sum(if_any(where(is.numeric), 42))`.
! Problem while computing `res = sum(if_any(where(is.numeric), 42))`.
Caused by error in `if_any()`:
`.fns` must be NULL, a function, a formula, or a list of functions/formulas.
! `.fns` must be NULL, a function, a formula, or a list of functions/formulas.
Code
(expect_error(tibble(x = 1) %>% summarise(res = sum(if_all(~ mean(.x))))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `res = sum(if_all(~mean(.x)))`.
! Problem while computing `res = sum(if_all(~mean(.x)))`.
Caused by error in `if_all()`:
Must supply a column selection.
i You most likely meant: `if_all(everything(), ~mean(.x))`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
! Must supply a column selection.
i You most likely meant: `if_all(everything(), ~mean(.x))`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
Code
(expect_error(tibble(x = 1) %>% summarise(res = sum(if_any(~ mean(.x))))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `res = sum(if_any(~mean(.x)))`.
! Problem while computing `res = sum(if_any(~mean(.x)))`.
Caused by error in `if_any()`:
Must supply a column selection.
i You most likely meant: `if_any(everything(), ~mean(.x))`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
! Must supply a column selection.
i You most likely meant: `if_any(everything(), ~mean(.x))`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
Code
(expect_error(across()))
Output
<error/rlang_error>
Error in `across()`: Must be used inside dplyr verbs.
Error in `across()`:
! Must be used inside dplyr verbs.
Code
(expect_error(c_across()))
Output
<error/rlang_error>
Error in `c_across()`: Must be used inside dplyr verbs.
Error in `c_across()`:
! Must be used inside dplyr verbs.
Code
error_fn <- (function(.) {
if (all(. > 10)) {
Expand All @@ -88,55 +90,55 @@
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `..1 = across(everything(), error_fn)`.
! Problem while computing `..1 = across(everything(), error_fn)`.
Caused by error in `across()`:
Problem while computing column `y`.
! Problem while computing column `y`.
Caused by error in `error_fn()`:
too small
! too small
Code
(expect_error(tibble(x = 1:10, y = 11:20) %>% mutate(across(everything(),
error_fn))))
Output
<error/dplyr:::mutate_error>
Error in `mutate()`:
Problem while computing `..1 = across(everything(), error_fn)`.
! Problem while computing `..1 = across(everything(), error_fn)`.
Caused by error in `across()`:
Problem while computing column `y`.
! Problem while computing column `y`.
Caused by error in `error_fn()`:
too small
! too small
Code
(expect_error(tibble(x = 1:10, y = 11:20) %>% summarise(force(across(everything(),
error_fn)))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `..1 = force(across(everything(), error_fn))`.
! Problem while computing `..1 = force(across(everything(), error_fn))`.
Caused by error in `across()`:
Problem while computing column `y`.
! Problem while computing column `y`.
Caused by error in `error_fn()`:
too small
! too small
Code
(expect_error(tibble(x = 1:10, y = 11:20) %>% mutate(force(across(everything(),
error_fn)))))
Output
<error/dplyr:::mutate_error>
Error in `mutate()`:
Problem while computing `..1 = force(across(everything(), error_fn))`.
! Problem while computing `..1 = force(across(everything(), error_fn))`.
Caused by error in `across()`:
Problem while computing column `y`.
! Problem while computing column `y`.
Caused by error in `error_fn()`:
too small
! too small
Code
(expect_error(tibble(x = 1) %>% summarise(across(everything(), list(f = mean,
f = mean)))))
Output
<error/rlang_error>
Error in `summarise()`:
Problem while computing `..1 = across(everything(), list(f = mean, f = mean))`.
! Problem while computing `..1 = across(everything(), list(f = mean, f = mean))`.
Caused by error in `across()`:
Names must be unique.
x These names are duplicated:
* "x_f" at locations 1 and 2.
! Names must be unique.
x These names are duplicated:
* "x_f" at locations 1 and 2.

# if_any() and if_all() aborts when predicate mistakingly used in .cols= (#5732)

Expand All @@ -145,43 +147,43 @@
Output
<error/rlang_error>
Error in `filter()`:
Problem while expanding `..1 = if_any(~.x > 5)`.
! Problem while expanding `..1 = if_any(~.x > 5)`.
Caused by error in `if_any()`:
Must supply a column selection.
i You most likely meant: `if_any(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
! Must supply a column selection.
i You most likely meant: `if_any(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
Code
(expect_error(filter(df, if_all(~ .x > 5))))
Output
<error/rlang_error>
Error in `filter()`:
Problem while expanding `..1 = if_all(~.x > 5)`.
! Problem while expanding `..1 = if_all(~.x > 5)`.
Caused by error in `if_all()`:
Must supply a column selection.
i You most likely meant: `if_all(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
! Must supply a column selection.
i You most likely meant: `if_all(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
Code
(expect_error(filter(df, !if_any(~ .x > 5))))
Output
<error/rlang_error>
Error in `filter()`:
Problem while computing `..1 = !if_any(~.x > 5)`.
! Problem while computing `..1 = !if_any(~.x > 5)`.
Caused by error in `if_any()`:
Must supply a column selection.
i You most likely meant: `if_any(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
! Must supply a column selection.
i You most likely meant: `if_any(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
Code
(expect_error(filter(df, !if_all(~ .x > 5))))
Output
<error/rlang_error>
Error in `filter()`:
Problem while computing `..1 = !if_all(~.x > 5)`.
! Problem while computing `..1 = !if_all(~.x > 5)`.
Caused by error in `if_all()`:
Must supply a column selection.
i You most likely meant: `if_all(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.
! Must supply a column selection.
i You most likely meant: `if_all(everything(), ~.x > 5)`.
i The first argument `.cols` selects a set of columns.
i The second argument `.fns` operates on each selected columns.

6 changes: 4 additions & 2 deletions tests/testthat/_snaps/all-equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@
(expect_error(union(tibble(a = 1), tibble(a = "1"))))
Output
<error/rlang_error>
Error in `union()`: `x` and `y` are not compatible.
Error in `union()`:
! `x` and `y` are not compatible.
x Incompatible types for column `a`: double vs character.
Code
(expect_error(union(tibble(a = 1, b = 2), tibble(a = "1", b = "2"))))
Output
<error/rlang_error>
Error in `union()`: `x` and `y` are not compatible.
Error in `union()`:
! `x` and `y` are not compatible.
x Incompatible types for column `a`: double vs character.
x Incompatible types for column `b`: double vs character.

16 changes: 9 additions & 7 deletions tests/testthat/_snaps/arrange.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@
Output
<error/rlang_error>
Error in `arrange()`:
Problem with the implicit `transmute()` step.
! Problem with the implicit `transmute()` step.
Caused by error in `transmute()`:
Can't transform a data frame with duplicate names.
! Can't transform a data frame with duplicate names.
Code
(expect_error(tibble(x = 1) %>% arrange(y)))
Output
<error/rlang_error>
Error in `arrange()`:
Problem with the implicit `transmute()` step.
x Problem while computing `..1 = y`.
! Problem with the implicit `transmute()` step.
x Problem while computing `..1 = y`.
Caused by error:
object 'y' not found
! object 'y' not found
Code
(expect_error(tibble(x = 1) %>% arrange(rep(x, 2))))
Output
<error/rlang_error>
Error in `arrange()`: Problem with the implicit `transmute()` step.
Error in `arrange()`:
! Problem with the implicit `transmute()` step.
x Problem while computing `..1 = rep(x, 2)`.
i `..1` must be size 1, not 2.

Expand All @@ -32,5 +33,6 @@
(expect_error(arrange(df, desc(x, y))))
Output
<error/rlang_error>
Error in `arrange()`: `desc()` must be called with exactly one argument.
Error in `arrange()`:
! `desc()` must be called with exactly one argument.

36 changes: 24 additions & 12 deletions tests/testthat/_snaps/bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,37 @@
(expect_error(bind_rows(df1, df2, .id = 5)))
Output
<error/rlang_error>
Error in `bind_rows()`: `.id` must be a scalar string, not a double vector of length 1.
Error in `bind_rows()`:
! `.id` must be a scalar string, not a double vector of length 1.
Code
ll <- list(1:5, env(a = 1))
(expect_error(bind_rows(ll)))
Output
<error/rlang_error>
Error in `bind_rows()`: Argument 1 must have names.
Error in `bind_rows()`:
! Argument 1 must have names.
Code
ll <- list(tibble(a = 1:5), env(a = 1))
(expect_error(bind_rows(ll)))
Output
<error/rlang_error>
Error in `bind_rows()`: Argument 2 must be a data frame or a named atomic vector.
Error in `bind_rows()`:
! Argument 2 must be a data frame or a named atomic vector.
Code
df1 <- tibble(a = factor("a"))
df2 <- tibble(a = 1L)
df3 <- tibble(a = 1)
(expect_error(bind_rows(df1, df2)))
Output
<error/vctrs_error_incompatible_type>
Error in `bind_rows()`: Can't combine `..1$a` <factor<4d52a>> and `..2$a` <integer>.
Error in `bind_rows()`:
! Can't combine `..1$a` <factor<4d52a>> and `..2$a` <integer>.
Code
(expect_error(bind_rows(df1, df3)))
Output
<error/vctrs_error_incompatible_type>
Error in `bind_rows()`: Can't combine `..1$a` <factor<4d52a>> and `..2$a` <double>.
Error in `bind_rows()`:
! Can't combine `..1$a` <factor<4d52a>> and `..2$a` <double>.
Code
df1 <- tibble(b = c(1, 2))
df2 <- tibble(b = c(1L, 2L))
Expand All @@ -60,37 +65,44 @@
(expect_error(bind_rows(df1, df3)))
Output
<error/vctrs_error_incompatible_type>
Error in `bind_rows()`: Can't combine `..1$b` <double> and `..2$b` <factor<a022a>>.
Error in `bind_rows()`:
! Can't combine `..1$b` <double> and `..2$b` <factor<a022a>>.
Code
(expect_error(bind_rows(df1, df4)))
Output
<error/vctrs_error_incompatible_type>
Error in `bind_rows()`: Can't combine `..1$b` <double> and `..2$b` <character>.
Error in `bind_rows()`:
! Can't combine `..1$b` <double> and `..2$b` <character>.
Code
(expect_error(bind_rows(df2, df3)))
Output
<error/vctrs_error_incompatible_type>
Error in `bind_rows()`: Can't combine `..1$b` <integer> and `..2$b` <factor<a022a>>.
Error in `bind_rows()`:
! Can't combine `..1$b` <integer> and `..2$b` <factor<a022a>>.
Code
(expect_error(bind_rows(df2, df4)))
Output
<error/vctrs_error_incompatible_type>
Error in `bind_rows()`: Can't combine `..1$b` <integer> and `..2$b` <character>.
Error in `bind_rows()`:
! Can't combine `..1$b` <integer> and `..2$b` <character>.
Code
# # unnamed vectors
(expect_error(bind_rows(1:2)))
Output
<error/rlang_error>
Error in `bind_rows()`: Argument 1 must have names.
Error in `bind_rows()`:
! Argument 1 must have names.
Code
# # incompatible size
(expect_error(bind_cols(a = 1:2, mtcars)))
Output
<error/vctrs_error_incompatible_size>
Error in `bind_cols()`: Can't recycle `a` (size 2) to match `..2` (size 32).
Error in `bind_cols()`:
! Can't recycle `a` (size 2) to match `..2` (size 32).
Code
(expect_error(bind_cols(mtcars, a = 1:3)))
Output
<error/vctrs_error_incompatible_size>
Error in `bind_cols()`: Can't recycle `..1` (size 32) to match `a` (size 3).
Error in `bind_cols()`:
! Can't recycle `..1` (size 32) to match `a` (size 3).

Loading

0 comments on commit 8347e27

Please sign in to comment.