MCPcopy Create free account
hub / github.com/apache/arrow / _compare_strftime_strings_on_windows

Function _compare_strftime_strings_on_windows

python/pyarrow/tests/test_compute.py:2511–2528  ·  view source on GitHub ↗
(result, expected)

Source from the content-addressed store, hash-verified

2509
2510
2511def _compare_strftime_strings_on_windows(result, expected):
2512 # TODO(GH-48767): On Windows, std::chrono returns GMT offset
2513 # instead of timezone abbreviations (e.g. "CET")
2514 # https://github.com/apache/arrow/issues/48767
2515
2516 # Match timezone suffixes (UTC), offsets (GMT+1), or abbreviations (CET)
2517 p = "(UTC|GMT[+-]?[0-9]*|[A-Z]{2,5})$"
2518
2519 ends_with_tz = pc.match_substring_regex(result, p)
2520 all_end_with_tz = pc.all(ends_with_tz, skip_nulls=True).as_py()
2521 assert all_end_with_tz, "All timezone values should be GMT offset format, "\
2522 f"UTC, or timezone abbreviation\nActual: {result}"
2523
2524 result_substring = pc.replace_substring_regex(result, pattern=p, replacement="")
2525 expected_substring = pc.replace_substring_regex(expected, pattern=p, replacement="")
2526 assert result_substring.equals(expected_substring), \
2527 f"Expected: {expected}, \nActual: {result} " \
2528 "\nNote: tz suffix is not being compared"
2529
2530
2531@pytest.mark.pandas

Callers 1

test_strftimeFunction · 0.85

Calls 3

as_pyMethod · 0.80
allMethod · 0.80
equalsMethod · 0.80

Tested by

no test coverage detected