(unit, base_frequency, round_frequency)
| 3006 | ) |
| 3007 | @pytest.mark.pandas |
| 3008 | def test_round_temporal_duration(unit, base_frequency, round_frequency): |
| 3009 | base = pd.Timedelta(base_frequency) |
| 3010 | values = pd.Series([ |
| 3011 | -7 * base, |
| 3012 | -4 * base, |
| 3013 | -1 * base, |
| 3014 | 0 * base, |
| 3015 | 1 * base, |
| 3016 | 4 * base, |
| 3017 | 7 * base, |
| 3018 | pd.NaT, |
| 3019 | ]) |
| 3020 | arrow_values = pa.array(values) |
| 3021 | assert pa.types.is_duration(arrow_values.type) |
| 3022 | |
| 3023 | options = pc.RoundTemporalOptions(4, unit) |
| 3024 | |
| 3025 | for arrow_round, pandas_round in ( |
| 3026 | (pc.ceil_temporal, values.dt.ceil), |
| 3027 | (pc.floor_temporal, values.dt.floor), |
| 3028 | (pc.round_temporal, values.dt.round), |
| 3029 | ): |
| 3030 | result = arrow_round( |
| 3031 | arrow_values, options=options |
| 3032 | ).to_pandas() |
| 3033 | expected = pandas_round(round_frequency) |
| 3034 | np.testing.assert_array_equal(result, expected) |
| 3035 | |
| 3036 | |
| 3037 | def test_count(): |
nothing calls this directly
no test coverage detected