@@ -172,6 +172,7 @@ def test_normalize(self):
172172class TestDatetime64 (tm .TestCase ):
173173
174174 def test_datetimeindex_accessors (self ):
175+ < << << << f2831e2a2074e27e5cd3cfc0728d989742ee4680
175176 dti_naive = DatetimeIndex (freq = 'D' , start = datetime (1998 , 1 , 1 ),
176177 periods = 365 )
177178 # GH 13303
@@ -255,6 +256,19 @@ def test_datetimeindex_accessors(self):
255256 self .assertEqual (len (dti .is_year_end ), 365 )
256257 self .assertEqual (len (dti .weekday_name ), 365 )
257258
259+ dti .name = 'name'
260+
261+ for accessor in ['year' , 'month' , 'day' , 'hour' , 'minute' , 'second' ,
262+ 'microsecond' , 'nanosecond' , 'dayofweek' , 'dayofyear' ,
263+ 'weekofyear' , 'quarter' ,
264+ 'is_month_start' , 'is_month_end' ,
265+ 'is_quarter_start' , 'is_quarter_end' ,
266+ 'is_year_start' , 'is_year_end' , 'weekday_name' ]:
267+ res = getattr (dti , accessor )
268+ self .assertEqual (len (res ), 365 )
269+ self .assertIsInstance (res , Index )
270+ self .assertEqual (res .name , 'name' )
271+
258272 dti = DatetimeIndex (freq = 'BQ-FEB' , start = datetime (1998 , 1 , 1 ),
259273 periods = 4 )
260274
0 commit comments