Skip to content

Commit

Permalink
clarify step_date() error for wrong features
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Oct 25, 2024
1 parent 7f3f995 commit e4ee075
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions R/date.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ step_date <-
offenders <- features[!features %in% feat]

cli::cli_abort(c(
x = "Possible values of {.arg features} should include:",
"*" = "{.or {.val {feat}}}.",
x = "Possible values of {.arg features} are {.or {.val {feat}}}.",
i = "Invalid values were: {.val {offenders}}."
))
}
Expand Down
9 changes: 3 additions & 6 deletions tests/testthat/_snaps/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
prep()
Condition
Error in `step_date()`:
x Possible values of `features` should include:
* "year", "doy", "mday", "week", "decimal", "semester", "quarter", "dow", or "month".
x Possible values of `features` are "year", "doy", "mday", "week", "decimal", "semester", "quarter", "dow", or "month".
i Invalid values were: "yearly".

---
Expand All @@ -26,8 +25,7 @@
"daily", "monthly", "yearly")) %>% prep()
Condition
Error in `step_date()`:
x Possible values of `features` should include:
* "year", "doy", "mday", "week", "decimal", "semester", "quarter", "dow", or "month".
x Possible values of `features` are "year", "doy", "mday", "week", "decimal", "semester", "quarter", "dow", or "month".
i Invalid values were: "daily", "monthly", and "yearly".

---
Expand All @@ -37,8 +35,7 @@
"daily", "month", "yearly")) %>% prep()
Condition
Error in `step_date()`:
x Possible values of `features` should include:
* "year", "doy", "mday", "week", "decimal", "semester", "quarter", "dow", or "month".
x Possible values of `features` are "year", "doy", "mday", "week", "decimal", "semester", "quarter", "dow", or "month".
i Invalid values were: "daily" and "yearly".

# bake method errors when needed non-standard role columns are missing
Expand Down

0 comments on commit e4ee075

Please sign in to comment.