nealrichardson commented on code in PR #13854:
URL: https://github.com/apache/arrow/pull/13854#discussion_r965230822


##########
r/tests/testthat/test-dplyr-funcs-datetime.R:
##########
@@ -155,6 +179,98 @@ test_that("strptime", {
   # RE2 library (not available on Windows with R 3.6)
   skip_if_not_available("re2")
 
+  compare_dplyr_binding(
+    .input %>%
+      mutate(
+        parsed_date_ymd = parse_date_time(string_1, orders = "Y-%m-d-%T")
+      ) %>%
+      collect(),
+    tibble::tibble(string_1 = c("2022-02-11-12:23:45", NA))
+  )
+
+})
+
+test_that("strptime works for individual formats", {
+  # strptime format support is not consistent across platforms
+  skip_on_cran()
+
+  # these functions' internals use some string processing which requires the
+  # RE2 library (not available on Windows with R 3.6)
+  skip_if_not_available("re2")
+
+  expect_equal(
+    strptime_test_df %>%
+      arrow_table() %>%
+        mutate(
+          parsed_H = strptime(string_H, format = "%Y-%m-%d-%H"),
+          parsed_I = strptime(string_I, format = "%Y-%m-%d-%I"),
+          parsed_j = strptime(string_j, format = "%Y-%m-%d-%j"),
+          parsed_M = strptime(string_M, format = "%Y-%m-%d-%M"),
+          parsed_S = strptime(string_S, format = "%Y-%m-%d-%S"),
+          parsed_U = strptime(string_U, format = "%Y-%m-%d-%U"),
+          parsed_w = strptime(string_w, format = "%Y-%m-%d-%w"),
+          parsed_W = strptime(string_W, format = "%Y-%m-%d-%W"),
+          parsed_y = strptime(string_y, format = "%y-%m-%d"),
+          parsed_Y = strptime(string_Y, format = "%Y-%m-%d"),
+          parsed_R = strptime(string_R, format = "%Y-%m-%d-%R"),
+          parsed_T = strptime(string_T, format = "%Y-%m-%d-%T")
+        ) %>%
+        collect(),
+    strptime_test_df %>%
+      mutate(
+        parsed_H = as.POSIXct(strptime(string_H, format = "%Y-%m-%d-%H")),
+        parsed_I = as.POSIXct(strptime(string_I, format = "%Y-%m-%d-%I")),
+        parsed_j = as.POSIXct(strptime(string_j, format = "%Y-%m-%d-%j")),
+        parsed_M = as.POSIXct(strptime(string_M, format = "%Y-%m-%d-%M")),
+        parsed_S = as.POSIXct(strptime(string_S, format = "%Y-%m-%d-%S")),
+        parsed_U = as.POSIXct(strptime(string_U, format = "%Y-%m-%d-%U")),
+        parsed_w = as.POSIXct(strptime(string_w, format = "%Y-%m-%d-%w")),
+        parsed_W = as.POSIXct(strptime(string_W, format = "%Y-%m-%d-%W")),
+        parsed_y = as.POSIXct(strptime(string_y, format = "%y-%m-%d")),
+        parsed_Y = as.POSIXct(strptime(string_Y, format = "%Y-%m-%d")),
+        parsed_R = as.POSIXct(strptime(string_R, format = "%Y-%m-%d-%R")),
+        parsed_T = as.POSIXct(strptime(string_T, format = "%Y-%m-%d-%T"))
+      ) %>%
+      collect()
+  )
+
+  # Some formats are not supported on Windows
+  if (!tolower(Sys.info()[["sysname"]]) == "windows") {

Review Comment:
   instead of `if()` you can `skip_on_os("windows")`



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to