Skip to content

Commit

Permalink
testing TZ = NA and TZ = NULL both result in a NULL "tzone" a…
Browse files Browse the repository at this point in the history
…ttribute
  • Loading branch information
dragosmg committed Feb 2, 2022
1 parent 2bdde3b commit aa9f33e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions r/tests/testthat/test-Array.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ test_that("array supports POSIXct (ARROW-3340)", {
test_that("array uses local timezone for POSIXct without timezone", {
withr::with_envvar(c(TZ = ""), {
times <- strptime("2019-02-03 12:34:56", format = "%Y-%m-%d %H:%M:%S") + 1:10
expect_equal(attr(times, "tzone"), NULL)
expect_array_roundtrip(times, timestamp("us", Sys.timezone()))

# Also test the INTSXP code path
Expand All @@ -273,10 +274,12 @@ test_that("array uses local timezone for POSIXct without timezone", {
})
withr::with_envvar(c(TZ = "Pacific/Marquesas"), {
times <- strptime("2019-02-03 12:34:56", format = "%Y-%m-%d %H:%M:%S") + 1:10
expect_equal(attr(times, "tzone"), "Pacific/Marquesas")
expect_array_roundtrip(times, timestamp("us", "Pacific/Marquesas"))
})
withr::with_envvar(c(TZ = NA), {
times <- strptime("2019-02-03 12:34:56", format = "%Y-%m-%d %H:%M:%S") + 1:10
expect_equal(attr(times, "tzone"), NULL)
expect_array_roundtrip(times, timestamp("us", Sys.timezone()))
})
})
Expand Down

0 comments on commit aa9f33e

Please sign in to comment.