dragosmg commented on a change in pull request #12357:
URL: https://github.com/apache/arrow/pull/12357#discussion_r807278646



##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -711,3 +711,71 @@ test_that("am/pm mirror lubridate", {
   )
 
 })
+
+test_that("extract tz", {
+  df <- tibble(
+    x = as.POSIXct(c("2022-02-07", "2022-02-10"), tz = "Pacific/Marquesas"),
+    #lubridate::tz() returns -for the time being - "UTC" for NAs, strings,
+    #dates and numerics
+    y = c("2022-02-07", NA),
+    z = as.Date(c("2022-02-07", NA)),
+    w = c(1L, 5L),
+    v = c(1.1, 2.47)
+  )
+
+  compare_dplyr_binding(
+    .input %>%
+      mutate(timezone_x = tz(x)) %>%
+      collect(),
+    df
+  )
+
+  expect_snapshot(
+    compare_dplyr_binding(
+      .input %>%
+        mutate(
+          timezone_y = tz(x),
+          timezone_z = tz(y)
+        ) %>%
+        collect(),
+      df
+    ),
+    error = TRUE

Review comment:
       Not sure what to say:
   * `error` is an argument to `expect_snapshot()` and `warning` is to 
`compare_dplyr_equal()` 
   * I like the `expect_shapshot(..., error = TRUE)` a bit better since with 
the change we would lose some of the message cover:
   <img width="1199" alt="image" 
src="https://user-images.githubusercontent.com/13176361/154141559-aa613f56-e790-4ae2-af5b-488bd8ce43ee.png";>
   




-- 
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]


Reply via email to