Skip to content

TST: add tests for DatetimeIndex.is_year_start/is_quarter_start on "BMS" frequency #58691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading