File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
2
2
from datetime import datetime
3
3
import pandas .util .testing as tm
4
+ from pandas import DatetimeIndex
4
5
from pandas .tseries .holiday import (
5
6
USFederalHolidayCalendar , USMemorialDay , USThanksgivingDay ,
6
7
nearest_workday , next_monday_or_tuesday , next_monday ,
@@ -49,6 +50,29 @@ def test_calendar(self):
49
50
self .assertEqual (list (holidays_2 .to_pydatetime ()),
50
51
self .holiday_list )
51
52
53
+ def test_calendar_caching (self ):
54
+ # Test for issue #9552
55
+
56
+ class TestCalendar (AbstractHolidayCalendar ):
57
+ def __init__ (self , name = None , rules = None ):
58
+ super (TestCalendar , self ).__init__ (
59
+ name = name ,
60
+ rules = rules
61
+ )
62
+
63
+ jan1 = TestCalendar (rules = [Holiday ('jan1' , year = 2015 , month = 1 , day = 1 )])
64
+ jan2 = TestCalendar (rules = [Holiday ('jan2' , year = 2015 , month = 1 , day = 2 )])
65
+
66
+ tm .assert_index_equal (
67
+ jan1 .holidays (),
68
+ DatetimeIndex (['01-Jan-2015' ])
69
+ )
70
+ tm .assert_index_equal (
71
+ jan2 .holidays (),
72
+ DatetimeIndex (['02-Jan-2015' ])
73
+ )
74
+
75
+
52
76
class TestHoliday (tm .TestCase ):
53
77
54
78
def setUp (self ):
You can’t perform that action at this time.
0 commit comments