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:2528–2545  ·  view source on GitHub ↗
(result, expected)

Source from the content-addressed store, hash-verified

2526
2527
2528def _compare_strftime_strings_on_windows(result, expected):
2529 # TODO(GH-48767): On Windows, std::chrono returns GMT offset
2530 # instead of timezone abbreviations (e.g. "CET")
2531 # https://github.com/apache/arrow/issues/48767
2532
2533 # Match timezone suffixes (UTC), offsets (GMT+1), or abbreviations (CET)
2534 p = "(UTC|GMT[+-]?[0-9]*|[A-Z]{2,5})$"
2535
2536 ends_with_tz = pc.match_substring_regex(result, p)
2537 all_end_with_tz = pc.all(ends_with_tz, skip_nulls=True).as_py()
2538 assert all_end_with_tz, "All timezone values should be GMT offset format, "\
2539 f"UTC, or timezone abbreviation\nActual: {result}"
2540
2541 result_substring = pc.replace_substring_regex(result, pattern=p, replacement="")
2542 expected_substring = pc.replace_substring_regex(expected, pattern=p, replacement="")
2543 assert result_substring.equals(expected_substring), \
2544 f"Expected: {expected}, \nActual: {result} " \
2545 "\nNote: tz suffix is not being compared"
2546
2547
2548@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