From 29ea6493c56eb1bb128b939d356683252651aa51 Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 31 Jan 2022 10:26:12 -0500 Subject: [PATCH 1/3] Require rlang >=1.0.0 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 348ce4a5..a9ae4966 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,7 +21,7 @@ Depends: R (>= 3.3) Imports: ellipsis (>= 0.3.1), - rlang (>= 0.4.10), + rlang (>= 1.0.0), tzdb (>= 0.2.0), vctrs (>= 0.3.7) Suggests: From f53bb870dde684768cf536c1ab77dbf60630907c Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 31 Jan 2022 10:28:22 -0500 Subject: [PATCH 2/3] Update snapshot tests to rlang 1.0.0 --- tests/testthat/_snaps/calendar.md | 21 +++++--- tests/testthat/_snaps/date.md | 26 ++++----- tests/testthat/_snaps/duration.md | 23 ++++---- tests/testthat/_snaps/gregorian-year-day.md | 3 +- .../_snaps/gregorian-year-month-day.md | 6 ++- .../_snaps/gregorian-year-month-weekday.md | 3 +- tests/testthat/_snaps/iso-year-week-day.md | 3 +- tests/testthat/_snaps/naive-time.md | 29 +++++----- tests/testthat/_snaps/posixt.md | 39 +++++++------- .../_snaps/quarterly-year-quarter-day.md | 3 +- tests/testthat/_snaps/sys-time.md | 54 ++++++++++--------- tests/testthat/_snaps/time-point.md | 30 +++++++---- tests/testthat/_snaps/utils.md | 3 +- tests/testthat/_snaps/zoned-time.md | 12 +++-- 14 files changed, 145 insertions(+), 110 deletions(-) diff --git a/tests/testthat/_snaps/calendar.md b/tests/testthat/_snaps/calendar.md index a2d23812..12c8567c 100644 --- a/tests/testthat/_snaps/calendar.md +++ b/tests/testthat/_snaps/calendar.md @@ -184,7 +184,8 @@ (expect_error(calendar_count_between(x, 1, "year"))) Output - `end` must be a . + Error in `calendar_count_between()`: + ! `end` must be a . # can't count with a precision finer than the calendar precision @@ -192,7 +193,8 @@ (expect_error(calendar_count_between(x, x, "month"))) Output - Precision of inputs must be at least as precise as `precision`. + Error in `calendar_count_between()`: + ! Precision of inputs must be at least as precise as `precision`. # `n` is validated @@ -200,28 +202,33 @@ (expect_error(calendar_count_between(x, x, "year", n = NA_integer_))) Output - `n` must be a single positive integer. + Error in `calendar_count_between()`: + ! `n` must be a single positive integer. Code (expect_error(calendar_count_between(x, x, "year", n = -1))) Output - `n` must be a single positive integer. + Error in `calendar_count_between()`: + ! `n` must be a single positive integer. Code (expect_error(calendar_count_between(x, x, "year", n = 1.5))) Output - Can't convert from `n` to due to loss of precision. + Error in `stop_vctrs()`: + ! Can't convert from `n` to due to loss of precision. * Locations: 1 Code (expect_error(calendar_count_between(x, x, "year", n = "x"))) Output - Can't convert `n` to . + Error in `stop_vctrs()`: + ! Can't convert `n` to . Code (expect_error(calendar_count_between(x, x, "year", n = c(1L, 2L)))) Output - `n` must be a single positive integer. + Error in `calendar_count_between()`: + ! `n` must be a single positive integer. # precision: can only be called on calendars diff --git a/tests/testthat/_snaps/date.md b/tests/testthat/_snaps/date.md index cc1df40b..ec86a464 100644 --- a/tests/testthat/_snaps/date.md +++ b/tests/testthat/_snaps/date.md @@ -122,7 +122,8 @@ Code date_format(x, format = "%z") - Warning + Condition + Warning: Failed to format 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -131,7 +132,8 @@ Code date_format(x, format = "%Z") - Warning + Condition + Warning: Failed to format 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -140,7 +142,8 @@ Code date_parse("foo") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -224,13 +227,10 @@ # checks empty dots - `...` is not empty. - - We detected these problematic arguments: - * `..1` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + `...` must be empty. + x Problematic argument: + * ..1 = new_date(2) + i Did you forget to name an argument? # must use a valid Date precision @@ -238,7 +238,8 @@ (expect_error(date_count_between(x, x, "hour"))) Output - `precision` must be one of: 'year', 'quarter', 'month', 'week', 'day'. + Error in `date_count_between_impl()`: + ! `precision` must be one of: 'year', 'quarter', 'month', 'week', 'day'. # can't count between a Date and a POSIXt @@ -246,7 +247,8 @@ (expect_error(date_count_between(x, y, "year"))) Output - `end` must be a . + Error in `date_count_between()`: + ! `end` must be a . # cannot get the zone of a Date diff --git a/tests/testthat/_snaps/duration.md b/tests/testthat/_snaps/duration.md index 83533039..e82fc682 100644 --- a/tests/testthat/_snaps/duration.md +++ b/tests/testthat/_snaps/duration.md @@ -130,13 +130,10 @@ # seq() validates dots - `...` is not empty. - - We detected these problematic arguments: - * `..1` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + `...` must be empty. + x Problematic argument: + * ..1 = 1 + i Did you forget to name an argument? # seq() enforces non-fractional results @@ -186,21 +183,24 @@ (expect_error(duration_years(1) / duration_years(2))) Output - > / > is not permitted + Error in `stop_vctrs()`: + ! > / > is not permitted Durations only support integer division. Did you want `%/%`? # ` %/% ` results in NA for OOB values Code out <- (numerator + one) %/% denominator - Warning + Condition + Warning: Conversion to integer is outside the range of an integer. `NA` values have been introduced, beginning at location 1. --- Code out <- (-numerator - one) %/% denominator - Warning + Condition + Warning: Conversion to integer is outside the range of an integer. `NA` values have been introduced, beginning at location 1. # ` %% ` casts the numeric to integer @@ -209,6 +209,7 @@ (expect_error(duration_hours(5) %% 2.5)) Output - Can't convert from `y` to due to loss of precision. + Error in `stop_vctrs()`: + ! Can't convert from `y` to due to loss of precision. * Locations: 1 diff --git a/tests/testthat/_snaps/gregorian-year-day.md b/tests/testthat/_snaps/gregorian-year-day.md index 8b773544..22ae900f 100644 --- a/tests/testthat/_snaps/gregorian-year-day.md +++ b/tests/testthat/_snaps/gregorian-year-day.md @@ -108,7 +108,8 @@ (expect_error(calendar_count_between(x, x, "day"))) Output - `precision` must be one of: 'year'. + Error in `calendar_count_between_standardize_precision_n()`: + ! `precision` must be one of: 'year'. # only granular precisions are allowed diff --git a/tests/testthat/_snaps/gregorian-year-month-day.md b/tests/testthat/_snaps/gregorian-year-month-day.md index d116c3bb..e0cd940f 100644 --- a/tests/testthat/_snaps/gregorian-year-month-day.md +++ b/tests/testthat/_snaps/gregorian-year-month-day.md @@ -110,7 +110,8 @@ Code year_month_day_parse("foo") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> @@ -142,7 +143,8 @@ (expect_error(calendar_count_between(x, x, "day"))) Output - `precision` must be one of: 'year', 'quarter', 'month'. + Error in `calendar_count_between_standardize_precision_n()`: + ! `precision` must be one of: 'year', 'quarter', 'month'. # only granular precisions are allowed diff --git a/tests/testthat/_snaps/gregorian-year-month-weekday.md b/tests/testthat/_snaps/gregorian-year-month-weekday.md index e216220c..eeec7ad8 100644 --- a/tests/testthat/_snaps/gregorian-year-month-weekday.md +++ b/tests/testthat/_snaps/gregorian-year-month-weekday.md @@ -132,7 +132,8 @@ (expect_error(calendar_count_between(x, x, "month"))) Output - 'year_month_weekday' types with a precision of >= 'day' cannot be trivially compared or ordered. Convert to 'year_month_day' to compare using day-of-month values. + Error in `vec_proxy_compare()`: + ! 'year_month_weekday' types with a precision of >= 'day' cannot be trivially compared or ordered. Convert to 'year_month_day' to compare using day-of-month values. # only granular precisions are allowed diff --git a/tests/testthat/_snaps/iso-year-week-day.md b/tests/testthat/_snaps/iso-year-week-day.md index ab20f51a..8168f346 100644 --- a/tests/testthat/_snaps/iso-year-week-day.md +++ b/tests/testthat/_snaps/iso-year-week-day.md @@ -100,7 +100,8 @@ (expect_error(calendar_count_between(x, x, "week"))) Output - `precision` must be one of: 'year'. + Error in `calendar_count_between_standardize_precision_n()`: + ! `precision` must be one of: 'year'. # only year precision is allowed diff --git a/tests/testthat/_snaps/naive-time.md b/tests/testthat/_snaps/naive-time.md index 39c49263..9dfeb2ed 100644 --- a/tests/testthat/_snaps/naive-time.md +++ b/tests/testthat/_snaps/naive-time.md @@ -10,7 +10,8 @@ Code naive_time_parse(x, precision = "day") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> @@ -20,7 +21,8 @@ Code naive_time_parse("foo") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> @@ -37,7 +39,8 @@ Code format(x, format = "%Z") - Warning + Condition + Warning: Failed to format 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -46,7 +49,8 @@ Code format(c(x, x), format = "%Z") - Warning + Condition + Warning: Failed to format 2 strings, beginning at location 1. Returning `NA` at the locations where there were format failures. Output [1] NA NA @@ -55,7 +59,8 @@ Code format(x, format = "%z") - Warning + Condition + Warning: Failed to format 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -64,7 +69,8 @@ Code format(c(x, x), format = "%z") - Warning + Condition + Warning: Failed to format 2 strings, beginning at location 1. Returning `NA` at the locations where there were format failures. Output [1] NA NA @@ -163,11 +169,8 @@ # empty dots are checked - `...` is not empty. - - We detected these problematic arguments: - * `..1` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + `...` must be empty. + x Problematic argument: + * ..1 = "roll-forward" + i Did you forget to name an argument? diff --git a/tests/testthat/_snaps/posixt.md b/tests/testthat/_snaps/posixt.md index 4af889cb..370e76aa 100644 --- a/tests/testthat/_snaps/posixt.md +++ b/tests/testthat/_snaps/posixt.md @@ -1,12 +1,8 @@ # can't accidentally supply `zone` to reinterpret date-time in new zone - `...` is not empty. - - We detected these problematic arguments: - * `zone` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + `...` must be empty. + x Problematic argument: + * zone = "America/New_York" # can resolve nonexistent midnight issues for Date -> POSIXct @@ -40,7 +36,8 @@ Code date_floor(x, "day", origin = origin) - Warning + Condition + Warning: `origin` has been floored from 'second' precision to 'day' precision to match `precision`. This floor has lost information. Output [1] "1970-01-01 EST" "1970-01-02 EST" @@ -166,7 +163,8 @@ Code date_time_parse("foo", "America/New_York") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -175,7 +173,8 @@ Code date_time_parse_complete("foo") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -184,7 +183,8 @@ Code date_time_parse_abbrev("foo", "America/New_York") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1] NA @@ -333,13 +333,10 @@ # checks empty dots - `...` is not empty. - - We detected these problematic arguments: - * `..1` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + `...` must be empty. + x Problematic argument: + * ..1 = new_datetime(2) + i Did you forget to name an argument? # must use a valid POSIXt precision @@ -347,7 +344,8 @@ (expect_error(date_count_between(x, x, "millisecond"))) Output - `precision` must be one of: 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'. + Error in `date_count_between_impl()`: + ! `precision` must be one of: 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'. # can't count between a POSIXt and a Date @@ -355,7 +353,8 @@ (expect_error(date_count_between(x, y, "year"))) Output - `end` must be a . + Error in `date_count_between()`: + ! `end` must be a . # op diff --git a/tests/testthat/_snaps/quarterly-year-quarter-day.md b/tests/testthat/_snaps/quarterly-year-quarter-day.md index f9d1c103..9ef33ef0 100644 --- a/tests/testthat/_snaps/quarterly-year-quarter-day.md +++ b/tests/testthat/_snaps/quarterly-year-quarter-day.md @@ -108,7 +108,8 @@ (expect_error(calendar_count_between(x, x, "day"))) Output - `precision` must be one of: 'year', 'quarter'. + Error in `calendar_count_between_standardize_precision_n()`: + ! `precision` must be one of: 'year', 'quarter'. # only granular precisions are allowed diff --git a/tests/testthat/_snaps/sys-time.md b/tests/testthat/_snaps/sys-time.md index acce4ca0..45dba0fb 100644 --- a/tests/testthat/_snaps/sys-time.md +++ b/tests/testthat/_snaps/sys-time.md @@ -2,7 +2,8 @@ Code sys_time_parse("foo") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> @@ -12,49 +13,53 @@ Code sys_time_parse_RFC_3339(x, precision = "day") - Error - `precision` must be at least 'second' precision. + Condition + Error in `validate_RFC_3339_precision_string()`: + ! `precision` must be at least 'second' precision. # `separator` is validated Code sys_time_parse_RFC_3339(x, separator = 1) - Error - `separator` must be a character vector. + Condition + Error in `arg_match0()`: + ! `separator` must be a string or character vector. --- Code sys_time_parse_RFC_3339(x, separator = "TT") - Error - `separator` must be one of "T", "t", or " ". + Condition + Error in `sys_time_parse_RFC_3339()`: + ! `separator` must be one of "T", "t", or " ", not "TT". # `offset` is validated Code sys_time_parse_RFC_3339(x, offset = 1) - Error - `offset` must be a character vector. + Condition + Error in `arg_match0()`: + ! `offset` must be a string or character vector. --- Code sys_time_parse_RFC_3339(x, offset = "ZZ") - Error - `offset` must be one of "Z", "z", "%z", or "%Ez". + Condition + Error in `sys_time_parse_RFC_3339()`: + ! `offset` must be one of "Z", "z", "%z", or "%Ez", not "ZZ". + i Did you mean "%z"? # sys-time-parse-RFC-3339: empty dots are checked Code sys_time_parse_RFC_3339(x, 1) - Error - `...` is not empty. - - We detected these problematic arguments: - * `..1` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + Condition + Error in `time_point_parse()`: + ! `...` must be empty. + x Problematic argument: + * ..1 = 1 + i Did you forget to name an argument? # default format is correct @@ -65,11 +70,8 @@ # empty dots are checked - `...` is not empty. - - We detected these problematic arguments: - * `..1` - - These dots only exist to allow future extensions and should be empty. - Did you misspecify an argument? + `...` must be empty. + x Problematic argument: + * ..1 = 123 + i Did you forget to name an argument? diff --git a/tests/testthat/_snaps/time-point.md b/tests/testthat/_snaps/time-point.md index 98a31128..9f9e0f20 100644 --- a/tests/testthat/_snaps/time-point.md +++ b/tests/testthat/_snaps/time-point.md @@ -135,7 +135,8 @@ Code out <- time_point_count_between(sys_days(0), sys_days(1000), "nanosecond") - Warning + Condition + Warning: Conversion from duration to integer is outside the range of an integer. `NA` values have been introduced, beginning at location 1. # both inputs must be time points @@ -144,12 +145,14 @@ (expect_error(time_point_count_between(sys_days(1), 1))) Output - `end` must be a . + Error in `time_point_count_between()`: + ! `end` must be a . Code (expect_error(time_point_count_between(1, sys_days(1)))) Output - `start` must be a . + Error in `time_point_count_between()`: + ! `start` must be a . # both inputs must be compatible @@ -157,7 +160,8 @@ (expect_error(time_point_count_between(x, y))) Output - Can't combine `start` > and `end` >. + Error in `stop_vctrs()`: + ! Can't combine `start` > and `end` >. # `n` is validated @@ -165,28 +169,33 @@ (expect_error(time_point_count_between(x, x, "day", n = NA_integer_))) Output - `n` must be a single positive integer. + Error in `time_point_count_between()`: + ! `n` must be a single positive integer. Code (expect_error(time_point_count_between(x, x, "day", n = -1))) Output - `n` must be a single positive integer. + Error in `time_point_count_between()`: + ! `n` must be a single positive integer. Code (expect_error(time_point_count_between(x, x, "day", n = 1.5))) Output - Can't convert from `n` to due to loss of precision. + Error in `stop_vctrs()`: + ! Can't convert from `n` to due to loss of precision. * Locations: 1 Code (expect_error(time_point_count_between(x, x, "day", n = "x"))) Output - Can't convert `n` to . + Error in `stop_vctrs()`: + ! Can't convert `n` to . Code (expect_error(time_point_count_between(x, x, "day", n = c(1L, 2L)))) Output - `n` must be a single positive integer. + Error in `time_point_count_between()`: + ! `n` must be a single positive integer. # `precision` must be a time point precision @@ -194,7 +203,8 @@ (expect_error(time_point_count_between(x, x, "year"))) Output - `precision` must be at least 'week' precision. + Error in `time_point_count_between()`: + ! `precision` must be at least 'week' precision. # can't mix chronological time points and calendrical durations diff --git a/tests/testthat/_snaps/utils.md b/tests/testthat/_snaps/utils.md index 30c47c6f..2644046b 100644 --- a/tests/testthat/_snaps/utils.md +++ b/tests/testthat/_snaps/utils.md @@ -2,7 +2,8 @@ Code posixt_tzone_standardize(character()) - Warning + Condition + Warning in `posixt_tzone_standardize()`: POSIXt input had a corrupt time zone attribute of `character(0)`. Defaulting to the current zone by assuming the zone is `""`. Output [1] "" diff --git a/tests/testthat/_snaps/zoned-time.md b/tests/testthat/_snaps/zoned-time.md index f8880cb1..ea280957 100644 --- a/tests/testthat/_snaps/zoned-time.md +++ b/tests/testthat/_snaps/zoned-time.md @@ -86,7 +86,8 @@ Code zoned_time_parse_complete(x) - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> @@ -96,7 +97,8 @@ Code zoned_time_parse_complete(x) - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> @@ -106,7 +108,8 @@ Code zoned_time_parse_complete(x) - Warning + Condition + Warning: Failed to parse 2 strings, beginning at location 1. Returning `NA` at the locations where there were parse failures. Output [2]> @@ -124,7 +127,8 @@ Code zoned_time_parse_abbrev(x, "America/New_York") - Warning + Condition + Warning: Failed to parse 1 string at location 1. Returning `NA` at that location. Output [1]> From 80199f75e62997a828ad0ea5aea6c2df051cb392 Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 31 Jan 2022 10:38:48 -0500 Subject: [PATCH 3/3] NEWS bullet --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index be7ba7e4..b20c1f56 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # clock (development version) +* Updated all snapshot tests to use rlang 1.0.0 (#285). + * `date_seq()` and the `seq()` methods for the calendar, time point, and duration types now allow `from > to` when `by > 0`. This now results in a size zero result rather than an error, which is more in line with