MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_parse_timezone

Function test_parse_timezone

arrow/tests/timezone.rs:22–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21#[test]
22fn test_parse_timezone() {
23 let cases = [
24 (
25 "2023-01-01 040506 America/Los_Angeles",
26 "2023-01-01T12:05:06+00:00",
27 ),
28 (
29 "2023-01-01 04:05:06.345 America/Los_Angeles",
30 "2023-01-01T12:05:06.345+00:00",
31 ),
32 (
33 "2023-01-01 04:05:06.345 America/Los_Angeles",
34 "2023-01-01T12:05:06.345+00:00",
35 ),
36 (
37 "2023-01-01 04:05:06.789 -08",
38 "2023-01-01T12:05:06.789+00:00",
39 ),
40 (
41 "2023-03-12 040506 America/Los_Angeles",
42 "2023-03-12T11:05:06+00:00",
43 ), // Daylight savings
44 ];
45
46 for (s, expected) in cases {
47 let actual = string_to_datetime(&Utc, s).unwrap().to_rfc3339();
48 assert_eq!(actual, expected, "{s}")
49 }
50}
51
52#[test]
53fn test_parse_timezone_invalid() {

Callers

nothing calls this directly

Calls 1

string_to_datetimeFunction · 0.85

Tested by

no test coverage detected