Skip to content

Commit

Permalink
TST: add tests for DatetimeIndex.is_year_start/is_quarter_start on "B…
Browse files Browse the repository at this point in the history
…MS" 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
  • Loading branch information
natmokval authored Jun 9, 2024
1 parent 81a44fa commit a787f45
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pandas/tests/indexes/datetimes/test_scalar_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,17 @@ def test_dti_is_year_start_freq_custom_business_day_with_digit(self):
with pytest.raises(ValueError, match=msg):
dr.is_year_start

@pytest.mark.parametrize("freq", ["3BMS", offsets.BusinessMonthBegin(3)])
def test_dti_is_year_quarter_start_freq_business_month_begin(self, freq):
# GH#58729
dr = date_range("2020-01-01", periods=5, freq=freq)
result = [x.is_year_start for x in dr]
assert result == [True, False, False, False, True]

dr = date_range("2020-01-01", periods=4, freq=freq)
result = [x.is_quarter_start for x in dr]
assert all(dr.is_quarter_start)


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

0 comments on commit a787f45

Please sign in to comment.