Skip to content

Commit 63e97b2

Browse files
committed
BUG: BDay() offsetting not behaving as expected
1 parent 22dbef1 commit 63e97b2

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

pandas/tests/tseries/offsets/test_offsets.py

+69
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pandas.compat.numpy import np_datetime64_compat
2020
from pandas.errors import PerformanceWarning
2121

22+
import pandas as pd
2223
import pandas._testing as tm
2324
from pandas.core.indexes.datetimes import DatetimeIndex, date_range
2425
from pandas.core.series import Series
@@ -2326,6 +2327,74 @@ def test_datetimeindex(self):
23262327
for idx in [idx1, idx2, idx3]:
23272328
tm.assert_index_equal(idx, expected)
23282329

2330+
def test_bday_ignores_timedeltas(self):
2331+
idx = pd.date_range("2010/02/01", "2010/02/15", freq="6H")
2332+
t1 = idx + BDay(offset=pd.Timedelta(3, unit="H"))
2333+
2334+
expected = DatetimeIndex(
2335+
[
2336+
"2010-02-02 03:00:00",
2337+
"2010-02-02 09:00:00",
2338+
"2010-02-02 15:00:00",
2339+
"2010-02-02 21:00:00",
2340+
"2010-02-03 03:00:00",
2341+
"2010-02-03 09:00:00",
2342+
"2010-02-03 15:00:00",
2343+
"2010-02-03 21:00:00",
2344+
"2010-02-04 03:00:00",
2345+
"2010-02-04 09:00:00",
2346+
"2010-02-04 15:00:00",
2347+
"2010-02-04 21:00:00",
2348+
"2010-02-05 03:00:00",
2349+
"2010-02-05 09:00:00",
2350+
"2010-02-05 15:00:00",
2351+
"2010-02-05 21:00:00",
2352+
"2010-02-08 03:00:00",
2353+
"2010-02-08 09:00:00",
2354+
"2010-02-08 15:00:00",
2355+
"2010-02-08 21:00:00",
2356+
"2010-02-08 03:00:00",
2357+
"2010-02-08 09:00:00",
2358+
"2010-02-08 15:00:00",
2359+
"2010-02-08 21:00:00",
2360+
"2010-02-08 03:00:00",
2361+
"2010-02-08 09:00:00",
2362+
"2010-02-08 15:00:00",
2363+
"2010-02-08 21:00:00",
2364+
"2010-02-09 03:00:00",
2365+
"2010-02-09 09:00:00",
2366+
"2010-02-09 15:00:00",
2367+
"2010-02-09 21:00:00",
2368+
"2010-02-10 03:00:00",
2369+
"2010-02-10 09:00:00",
2370+
"2010-02-10 15:00:00",
2371+
"2010-02-10 21:00:00",
2372+
"2010-02-11 03:00:00",
2373+
"2010-02-11 09:00:00",
2374+
"2010-02-11 15:00:00",
2375+
"2010-02-11 21:00:00",
2376+
"2010-02-12 03:00:00",
2377+
"2010-02-12 09:00:00",
2378+
"2010-02-12 15:00:00",
2379+
"2010-02-12 21:00:00",
2380+
"2010-02-15 03:00:00",
2381+
"2010-02-15 09:00:00",
2382+
"2010-02-15 15:00:00",
2383+
"2010-02-15 21:00:00",
2384+
"2010-02-15 03:00:00",
2385+
"2010-02-15 09:00:00",
2386+
"2010-02-15 15:00:00",
2387+
"2010-02-15 21:00:00",
2388+
"2010-02-15 03:00:00",
2389+
"2010-02-15 09:00:00",
2390+
"2010-02-15 15:00:00",
2391+
"2010-02-15 21:00:00",
2392+
"2010-02-16 03:00:00",
2393+
],
2394+
freq=None,
2395+
)
2396+
tm.assert_index_equal(t1, expected)
2397+
23292398

23302399
class TestCustomBusinessHour(Base):
23312400
_offset = CustomBusinessHour

0 commit comments

Comments
 (0)