dragosmg commented on code in PR #13627:
URL: https://github.com/apache/arrow/pull/13627#discussion_r925346214
##########
r/tests/testthat/test-dplyr-funcs-datetime.R:
##########
@@ -2474,4 +2534,24 @@ test_that("build_formats() and
build_format_from_order()", {
"%y%b%d%H%M%S", "%Y%b%d%H%M%S"
)
)
+
+ expect_equal(
+ build_format_from_order("ymdHM"),
+ c(
+ "%y-%m-%d-%H-%M", "%Y-%m-%d-%H-%M", "%y-%B-%d-%H-%M",
+ "%Y-%B-%d-%H-%M", "%y-%b-%d-%H-%M", "%Y-%b-%d-%H-%M",
+ "%y%m%d%H%M", "%Y%m%d%H%M", "%y%B%d%H%M", "%Y%B%d%H%M",
+ "%y%b%d%H%M", "%Y%b%d%H%M"
+ )
+ )
+
+ expect_equal(
+ build_format_from_order("ymdH"),
+ c(
+ "%y-%m-%d-%H", "%Y-%m-%d-%H", "%y-%B-%d-%H",
+ "%Y-%B-%d-%H", "%y-%b-%d-%H", "%Y-%b-%d-%H",
+ "%y%m%d%H", "%Y%m%d%H", "%y%B%d%H", "%Y%B%d%H",
+ "%y%b%d%H", "%Y%b%d%H"
+ )
+ )
})
Review Comment:
I'd say maybe a couple of tests covering the additional args (`quiet`,
`locale` & `truncated`). I would only test for `ymd_hms()`, for example, not
all of the individual parsers.
Something like (maybe added to [this
block](https://github.com/apache/arrow/blob/0330353a93eff799616bf66e0e994236393458f7/r/tests/testthat/test-dplyr-funcs-datetime.R#L2342-L2386),
where you already have a data frame defined for testing with truncated
formats):
```r
compare_dplyr_binding(
.input %>%
mutate(dttm = ymd_hms(truncated_ymd_string, truncated = 3)) %>%
collect(),
test_truncation_df
)
```
There is also a
[block](https://github.com/apache/arrow/blob/0330353a93eff799616bf66e0e994236393458f7/r/tests/testthat/test-dplyr-funcs-datetime.R#L2324-L2340)
for testing `quiet = FALSE` not supported.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]