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

Function test_round_temporal

python/pyarrow/tests/test_compute.py:2950–2982  ·  view source on GitHub ↗
(unit)

Source from the content-addressed store, hash-verified

2948 "second", "minute", "hour", "day"))
2949@pytest.mark.pandas
2950def test_round_temporal(unit):
2951 values = (1, 2, 3, 4, 5, 6, 7, 10, 15, 24, 60, 250, 500, 750)
2952 timestamps = [
2953 "1923-07-07 08:52:35.203790336",
2954 "1931-03-17 10:45:00.641559040",
2955 "1932-06-16 01:16:42.911994368",
2956 "1941-05-27 11:46:43.822831872",
2957 "1943-12-14 07:32:05.424766464",
2958 "1954-04-12 04:31:50.699881472",
2959 "1966-02-12 17:41:28.693282560",
2960 "1967-02-26 05:56:46.922376960",
2961 "1975-11-01 10:55:37.016146432",
2962 "1982-01-21 18:43:44.517366784",
2963 "1992-01-01 00:00:00.100000000",
2964 "1999-12-04 05:55:34.794991104",
2965 "2026-10-26 08:39:00.316686848"]
2966
2967 # Windows timezone database appears to disagree with IANA timezone database on
2968 # some historical timestamps. We exclude those timestamps from testing on Windows.
2969 # Specifically removing:
2970 # "1941-05-27 11:46:43.822831872" and "1943-12-14 07:32:05.424766464"
2971 if sys.platform == "win32":
2972 timestamps = timestamps[:3] + timestamps[5:]
2973
2974 ts = pd.Series([pd.Timestamp(x, unit="ns") for x in timestamps])
2975 _check_temporal_rounding(ts, values, unit)
2976
2977 timezones = ["Asia/Kolkata", "America/New_York", "Etc/GMT-4", "Etc/GMT+4",
2978 "Europe/Brussels", "Pacific/Marquesas", "America/Chicago", "UTC"]
2979
2980 for timezone in timezones:
2981 ts_zoned = ts.dt.tz_localize("UTC").dt.tz_convert(timezone)
2982 _check_temporal_rounding(ts_zoned, values, unit)
2983
2984
2985def test_count():

Callers

nothing calls this directly

Calls 2

_check_temporal_roundingFunction · 0.85
TimestampMethod · 0.45

Tested by

no test coverage detected