Skip to content

Commit a787f45

Browse files
authored
TST: add tests for DatetimeIndex.is_year_start/is_quarter_start on "BMS" frequency (#58691)
* bug-DatetimeIndex-is_year_start-breaks-on-freq-BusinessMonthStart * correct def get_start_end_field * fixup * parametrize test, and a note to v3.0.0
1 parent 81a44fa commit a787f45

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/indexes/datetimes/test_scalar_compat.py

+11
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,17 @@ def test_dti_is_year_start_freq_custom_business_day_with_digit(self):
424424
with pytest.raises(ValueError, match=msg):
425425
dr.is_year_start
426426

427+
@pytest.mark.parametrize("freq", ["3BMS", offsets.BusinessMonthBegin(3)])
428+
def test_dti_is_year_quarter_start_freq_business_month_begin(self, freq):
429+
# GH#58729
430+
dr = date_range("2020-01-01", periods=5, freq=freq)
431+
result = [x.is_year_start for x in dr]
432+
assert result == [True, False, False, False, True]
433+
434+
dr = date_range("2020-01-01", periods=4, freq=freq)
435+
result = [x.is_quarter_start for x in dr]
436+
assert all(dr.is_quarter_start)
437+
427438

428439
@given(
429440
dt=st.datetimes(min_value=datetime(1960, 1, 1), max_value=datetime(1980, 1, 1)),

0 commit comments

Comments
 (0)