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

Function test_parse_timezone_invalid

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

Source from the content-addressed store, hash-verified

51
52#[test]
53fn test_parse_timezone_invalid() {
54 let cases = [
55 (
56 "2015-01-20T17:35:20-24:00",
57 "Parser error: Invalid timezone \"-24:00\": failed to parse timezone",
58 ),
59 (
60 "2023-01-01 04:05:06.789 +07:30:00",
61 "Parser error: Invalid timezone \"+07:30:00\": failed to parse timezone",
62 ),
63 (
64 // Sunday, 12 March 2023, 02:00:00 clocks are turned forward 1 hour to
65 // Sunday, 12 March 2023, 03:00:00 local daylight time instead.
66 "2023-03-12 02:05:06 America/Los_Angeles",
67 "Parser error: Error parsing timestamp from '2023-03-12 02:05:06 America/Los_Angeles': error computing timezone offset",
68 ),
69 (
70 // Sunday, 5 November 2023, 02:00:00 clocks are turned backward 1 hour to
71 // Sunday, 5 November 2023, 01:00:00 local standard time instead.
72 "2023-11-05 01:30:06 America/Los_Angeles",
73 "Parser error: Error parsing timestamp from '2023-11-05 01:30:06 America/Los_Angeles': error computing timezone offset",
74 ),
75 ];
76
77 for (s, expected) in cases {
78 let actual = string_to_datetime(&Utc, s).unwrap_err().to_string();
79 assert_eq!(actual, expected)
80 }
81}

Callers

nothing calls this directly

Calls 1

string_to_datetimeFunction · 0.85

Tested by

no test coverage detected