File tree 1 file changed +70
-0
lines changed
pandas/tests/tseries/offsets
1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change 5
5
import numpy as np
6
6
import pytest
7
7
8
+ import pandas as pd
9
+
8
10
from pandas ._libs .tslibs import (
9
11
NaT ,
10
12
OutOfBoundsDatetime ,
@@ -2326,6 +2328,74 @@ def test_datetimeindex(self):
2326
2328
for idx in [idx1 , idx2 , idx3 ]:
2327
2329
tm .assert_index_equal (idx , expected )
2328
2330
2331
+ def test_bday_ignores_timedeltas (self ):
2332
+ idx = pd .date_range ("2010/02/01" , "2010/02/15" , freq = "6H" )
2333
+ t1 = idx + BDay (offset = pd .Timedelta (3 , unit = "H" ))
2334
+
2335
+ expected = DatetimeIndex (
2336
+ [
2337
+ "2010-02-02 03:00:00" ,
2338
+ "2010-02-02 09:00:00" ,
2339
+ "2010-02-02 15:00:00" ,
2340
+ "2010-02-02 21:00:00" ,
2341
+ "2010-02-03 03:00:00" ,
2342
+ "2010-02-03 09:00:00" ,
2343
+ "2010-02-03 15:00:00" ,
2344
+ "2010-02-03 21:00:00" ,
2345
+ "2010-02-04 03:00:00" ,
2346
+ "2010-02-04 09:00:00" ,
2347
+ "2010-02-04 15:00:00" ,
2348
+ "2010-02-04 21:00:00" ,
2349
+ "2010-02-05 03:00:00" ,
2350
+ "2010-02-05 09:00:00" ,
2351
+ "2010-02-05 15:00:00" ,
2352
+ "2010-02-05 21:00:00" ,
2353
+ "2010-02-08 03:00:00" ,
2354
+ "2010-02-08 09:00:00" ,
2355
+ "2010-02-08 15:00:00" ,
2356
+ "2010-02-08 21:00:00" ,
2357
+ "2010-02-08 03:00:00" ,
2358
+ "2010-02-08 09:00:00" ,
2359
+ "2010-02-08 15:00:00" ,
2360
+ "2010-02-08 21:00:00" ,
2361
+ "2010-02-08 03:00:00" ,
2362
+ "2010-02-08 09:00:00" ,
2363
+ "2010-02-08 15:00:00" ,
2364
+ "2010-02-08 21:00:00" ,
2365
+ "2010-02-09 03:00:00" ,
2366
+ "2010-02-09 09:00:00" ,
2367
+ "2010-02-09 15:00:00" ,
2368
+ "2010-02-09 21:00:00" ,
2369
+ "2010-02-10 03:00:00" ,
2370
+ "2010-02-10 09:00:00" ,
2371
+ "2010-02-10 15:00:00" ,
2372
+ "2010-02-10 21:00:00" ,
2373
+ "2010-02-11 03:00:00" ,
2374
+ "2010-02-11 09:00:00" ,
2375
+ "2010-02-11 15:00:00" ,
2376
+ "2010-02-11 21:00:00" ,
2377
+ "2010-02-12 03:00:00" ,
2378
+ "2010-02-12 09:00:00" ,
2379
+ "2010-02-12 15:00:00" ,
2380
+ "2010-02-12 21:00:00" ,
2381
+ "2010-02-15 03:00:00" ,
2382
+ "2010-02-15 09:00:00" ,
2383
+ "2010-02-15 15:00:00" ,
2384
+ "2010-02-15 21:00:00" ,
2385
+ "2010-02-15 03:00:00" ,
2386
+ "2010-02-15 09:00:00" ,
2387
+ "2010-02-15 15:00:00" ,
2388
+ "2010-02-15 21:00:00" ,
2389
+ "2010-02-15 03:00:00" ,
2390
+ "2010-02-15 09:00:00" ,
2391
+ "2010-02-15 15:00:00" ,
2392
+ "2010-02-15 21:00:00" ,
2393
+ "2010-02-16 03:00:00" ,
2394
+ ],
2395
+ freq = None ,
2396
+ )
2397
+ tm .assert_index_equal (t1 , expected )
2398
+
2329
2399
2330
2400
class TestCustomBusinessHour (Base ):
2331
2401
_offset = CustomBusinessHour
You can’t perform that action at this time.
0 commit comments