@@ -117,9 +117,11 @@ test_that("cannot parse nonexistent time", {
117117
118118 x <- " 1970-04-26 02:30:00-05:00[America/New_York]"
119119
120- expect_identical(
121- expect_warning(zoned_time_parse_complete(x )),
122- as_zoned_time(naive_seconds(NA ), zone )
120+ expect_warning(
121+ expect_identical(
122+ zoned_time_parse_complete(x ),
123+ as_zoned_time(naive_seconds(NA ), zone )
124+ )
123125 )
124126
125127 expect_snapshot(zoned_time_parse_complete(x ))
@@ -149,9 +151,11 @@ test_that("offset must align with unique offset", {
149151 # Should be `-05:00`
150152 x <- " 2019-01-01 01:02:03-03:00[America/New_York]"
151153
152- expect_identical(
153- expect_warning(zoned_time_parse_complete(x )),
154- as_zoned_time(naive_seconds(NA ), zone )
154+ expect_warning(
155+ expect_identical(
156+ zoned_time_parse_complete(x ),
157+ as_zoned_time(naive_seconds(NA ), zone )
158+ )
155159 )
156160
157161 expect_snapshot(zoned_time_parse_complete(x ))
@@ -166,9 +170,11 @@ test_that("offset must align with one of two possible ambiguous offsets", {
166170 " 1970-10-25 01:30:00-06:00[America/New_York]"
167171 )
168172
169- expect_identical(
170- expect_warning(zoned_time_parse_complete(x )),
171- as_zoned_time(naive_seconds(c(NA , NA )), zone )
173+ expect_warning(
174+ expect_identical(
175+ zoned_time_parse_complete(x ),
176+ as_zoned_time(naive_seconds(c(NA , NA )), zone )
177+ )
172178 )
173179
174180 expect_snapshot(zoned_time_parse_complete(x ))
@@ -208,9 +214,11 @@ test_that("all `NA`s uses UTC time zone (#162)", {
208214})
209215
210216test_that(" all failures uses UTC time zone (#162)" , {
211- expect_identical(
212- expect_warning(zoned_time_parse_complete(c(" foo" , " bar" ))),
213- as_zoned_time(naive_seconds(c(NA , NA )), " UTC" )
217+ expect_warning(
218+ expect_identical(
219+ zoned_time_parse_complete(c(" foo" , " bar" )),
220+ as_zoned_time(naive_seconds(c(NA , NA )), " UTC" )
221+ )
214222 )
215223})
216224
@@ -242,9 +250,12 @@ test_that("leftover subseconds result in a parse failure", {
242250 # This defaults to `%6S`, which parses `01.123` then stops,
243251 # leaving a `8` for `%z` to parse, resulting in a failure. Because everything
244252 # fails, we get a UTC time zone.
245- expect_identical(
246- expect_warning(zoned_time_parse_complete(x , precision = " millisecond" ), class = " clock_warning_parse_failures" ),
247- as_zoned_time(naive_seconds(NA ) + duration_milliseconds(NA ), zone = " UTC" )
253+ expect_warning(
254+ expect_identical(
255+ zoned_time_parse_complete(x , precision = " millisecond" ),
256+ as_zoned_time(naive_seconds(NA ) + duration_milliseconds(NA ), zone = " UTC" )
257+ ),
258+ class = " clock_warning_parse_failures"
248259 )
249260})
250261
@@ -263,12 +274,12 @@ test_that("parsing fails when undocumented rounding behavior would result in inv
263274
264275 # Requesting `%6S` parses the full `59.550`, which is immediately rounded to `60` which looks invalid.
265276 # The correct way to do this is to parse the milliseconds, then round.
266- expect_identical (
267- expect_warning (
277+ expect_warning (
278+ expect_identical (
268279 zoned_time_parse_complete(x , precision = " second" , format = " %Y-%m-%d %H:%M:%6S%Ez[%Z]" ),
269- class = " clock_warning_parse_failures "
280+ as_zoned_time(as_naive_time(year_month_day( NA , NA , NA , NA , NA , NA )), zone = " UTC " )
270281 ),
271- as_zoned_time(as_naive_time(year_month_day( NA , NA , NA , NA , NA , NA )), zone = " UTC " )
282+ class = " clock_warning_parse_failures "
272283 )
273284})
274285
@@ -322,28 +333,32 @@ test_that("abbreviation is used to resolve ambiguity", {
322333})
323334
324335test_that(" nonexistent times are NAs" , {
325- expect_identical (
326- expect_warning (
327- zoned_time_parse_abbrev(" 1970-04-26 02:30:00 EST" , " America/New_York" )
328- ),
329- as_zoned_time(sys_seconds( NA ), " America/New_York " )
336+ expect_warning (
337+ expect_identical (
338+ zoned_time_parse_abbrev(" 1970-04-26 02:30:00 EST" , " America/New_York" ),
339+ as_zoned_time(sys_seconds( NA ), " America/New_York " )
340+ )
330341 )
331342})
332343
333344test_that(" abbreviation must match the one implied from naive + time zone name lookup" , {
334345 x <- " 1970-01-01 00:00:00 FOOBAR"
335346
336- expect_identical(
337- expect_warning(zoned_time_parse_abbrev(x , " America/New_York" )),
338- as_zoned_time(sys_days(NA ), " America/New_York" )
347+ expect_warning(
348+ expect_identical(
349+ zoned_time_parse_abbrev(x , " America/New_York" ),
350+ as_zoned_time(sys_days(NA ), " America/New_York" )
351+ )
339352 )
340353
341354 # Should be EST
342355 x <- " 1970-01-01 00:00:00 EDT"
343356
344- expect_identical(
345- expect_warning(zoned_time_parse_abbrev(x , " America/New_York" )),
346- as_zoned_time(sys_days(NA ), " America/New_York" )
357+ expect_warning(
358+ expect_identical(
359+ zoned_time_parse_abbrev(x , " America/New_York" ),
360+ as_zoned_time(sys_days(NA ), " America/New_York" )
361+ )
347362 )
348363
349364 expect_snapshot(zoned_time_parse_abbrev(x , " America/New_York" ))
0 commit comments