Skip to content
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

Update standalone files + standardize snapshot tests #1579

Merged
merged 11 commits into from
Oct 25, 2024
Prev Previous commit
Next Next commit
remove cnd_class = TRUE
  • Loading branch information
olivroy committed Oct 24, 2024
commit b49c272d93b43b90564f8303af7624077973e0bc
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/append.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Code
df_append(df1, df2, after = 1.5)
Condition <rlang_error>
Condition
Error in `df_append()`:
! `after` must be a whole number, not the number 1.5.
i This is an internal error that was detected in the tidyr package.
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/chop.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

Code
unchop(df, c(x, y))
Condition <rlang_error>
Condition
Error in `unchop()`:
! In row 1, can't recycle input of size 2 to size 3.

# empty typed inputs are considered in common size, but NULLs aren't

Code
unchop(df, c(x, y))
Condition <rlang_error>
Condition
Error in `unchop()`:
! In row 1, can't recycle input of size 0 to size 2.

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/drop-na.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

Code
drop_na(df, list())
Condition <vctrs_error_subscript_type>
Condition
Error in `drop_na()`:
! Can't select columns with `list()`.
x `list()` must be numeric or character, not an empty list.
Code
drop_na(df, "z")
Condition <vctrs_error_subscript_oob>
Condition
Error in `drop_na()`:
! Can't select columns that don't exist.
x Column `z` doesn't exist.
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/expand.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Code
crossing(x = 1:10, y = quote(a))
Condition <vctrs_error_scalar_type>
Condition
Error in `crossing()`:
! `..2` must be a vector, not a symbol.

Expand Down Expand Up @@ -37,7 +37,7 @@

Code
expand_grid(x = x, x = x)
Condition <vctrs_error_names_must_be_unique>
Condition
Error in `expand_grid()`:
! Names must be unique.
x These names are duplicated:
Expand Down Expand Up @@ -65,7 +65,7 @@

Code
grid_dots(lm(1 ~ 1))
Condition <vctrs_error_scalar_type>
Condition
Error:
! `..1` must be a vector, not a <lm> object.

6 changes: 3 additions & 3 deletions tests/testthat/_snaps/extract.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

Code
extract(df, x, "y", ".")
Condition <rlang_error>
Condition
Error in `extract()`:
! `regex` should define 1 groups; 0 found.
Code
extract(df, x, c("y", "z"), ".")
Condition <rlang_error>
Condition
Error in `extract()`:
! `regex` should define 2 groups; 0 found.

# informative error if using stringr modifier functions (#693)

Code
extract(df, x, "x", regex = regex)
Condition <rlang_error>
Condition
Error in `extract()`:
! `regex` can't use modifiers from stringr.

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/gather.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Code
gather(df, key, val, -x)
Condition <simpleError>
Condition
Error:
! 'x' is a POSIXlt. Please convert to POSIXct.
Code
gather(df, key, val, -y)
Condition <simpleError>
Condition
Error:
! Column 1 is a POSIXlt. Please convert to POSIXct.

Expand All @@ -23,12 +23,12 @@

Code
gather(df, key, val, -x)
Condition <simpleError>
Condition
Error:
! All columns must be atomic vectors or lists. Problem with 'x'
Code
gather(df, key, val, -y)
Condition <simpleError>
Condition
Error:
! All columns must be atomic vectors or lists. Problem with column 2.

Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/hoist.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@

Code
hoist(df, x, "b", .ptype = list(b = double()))
Condition <vctrs_error_cast>
Condition
Error in `hoist()`:
! Can't convert `..1` <list> to <double>.

# non-vectors generate a cast error if a ptype is supplied

Code
hoist(df, x, "b", .ptype = list(b = integer()))
Condition <vctrs_error_scalar_type>
Condition
Error in `hoist()`:
! `..1` must be a vector, not a symbol.

# input validation catches problems

Code
df %>% hoist(y)
Condition <rlang_error>
Condition
Error in `hoist()`:
! `.data[[.col]]` must be a list, not the number 1.
Code
df %>% hoist(x, 1)
Condition <rlang_error>
Condition
Error in `hoist()`:
! All elements of `...` must be named.
Code
df %>% hoist(x, a = "a", a = "b")
Condition <rlang_error>
Condition
Error in `hoist()`:
! The names of `...` must be unique.

# can't hoist() from a data frame column

Code
hoist(df, a, xx = 1)
Condition <rlang_error>
Condition
Error in `hoist()`:
! `.data[[.col]]` must be a list, not a <tbl_df/tbl/data.frame> object.

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/nest-legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Code
unnest_legacy(df)
Condition <rlang_error>
Condition
Error in `unnest_legacy()`:
! Each column must either be a list of vectors or a list of data frames.
i Problems in: `x`
Expand All @@ -11,15 +11,15 @@

Code
unnest_legacy(df)
Condition <rlang_error>
Condition
Error in `unnest_legacy()`:
! All nested columns must have the same number of elements.

---

Code
unnest_legacy(df)
Condition <rlang_error>
Condition
Error in `unnest_legacy()`:
! All nested columns must have the same number of elements.

Loading