@@ -172,6 +172,7 @@ def test_normalize(self):
172
172
class TestDatetime64 (tm .TestCase ):
173
173
174
174
def test_datetimeindex_accessors (self ):
175
+ < << << << f2831e2a2074e27e5cd3cfc0728d989742ee4680
175
176
dti_naive = DatetimeIndex (freq = 'D' , start = datetime (1998 , 1 , 1 ),
176
177
periods = 365 )
177
178
# GH 13303
@@ -255,6 +256,19 @@ def test_datetimeindex_accessors(self):
255
256
self .assertEqual (len (dti .is_year_end ), 365 )
256
257
self .assertEqual (len (dti .weekday_name ), 365 )
257
258
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
+
258
272
dti = DatetimeIndex (freq = 'BQ-FEB' , start = datetime (1998 , 1 , 1 ),
259
273
periods = 4 )
260
274
0 commit comments