@@ -424,7 +424,7 @@ def test_total_seconds(self):
424424 freq = 's' )
425425 expt = [1 * 86400 + 10 * 3600 + 11 * 60 + 12 + 100123456. / 1e9 ,
426426 1 * 86400 + 10 * 3600 + 11 * 60 + 13 + 100123456. / 1e9 ]
427- tm .assert_almost_equal (rng .total_seconds (), np . array (expt ))
427+ tm .assert_almost_equal (rng .total_seconds (), Index (expt ))
428428
429429 # test Series
430430 s = Series (rng )
@@ -486,16 +486,16 @@ def test_append_numpy_bug_1681(self):
486486 def test_fields (self ):
487487 rng = timedelta_range ('1 days, 10:11:12.100123456' , periods = 2 ,
488488 freq = 's' )
489- self .assert_numpy_array_equal (rng .days , np .array (
490- [1 , 1 ], dtype = 'int64' ))
491- self .assert_numpy_array_equal (
489+ self .assert_index_equal (rng .days , Index ([1 , 1 ], dtype = 'int64' ))
490+ self .assert_index_equal (
492491 rng .seconds ,
493- np .array ([10 * 3600 + 11 * 60 + 12 , 10 * 3600 + 11 * 60 + 13 ],
494- dtype = 'int64' ))
495- self .assert_numpy_array_equal (rng .microseconds , np .array (
496- [100 * 1000 + 123 , 100 * 1000 + 123 ], dtype = 'int64' ))
497- self .assert_numpy_array_equal (rng .nanoseconds , np .array (
498- [456 , 456 ], dtype = 'int64' ))
492+ Index ([10 * 3600 + 11 * 60 + 12 , 10 * 3600 + 11 * 60 + 13 ],
493+ dtype = 'int64' ))
494+ self .assert_index_equal (
495+ rng .microseconds ,
496+ Index ([100 * 1000 + 123 , 100 * 1000 + 123 ], dtype = 'int64' ))
497+ self .assert_index_equal (rng .nanoseconds ,
498+ Index ([456 , 456 ], dtype = 'int64' ))
499499
500500 self .assertRaises (AttributeError , lambda : rng .hours )
501501 self .assertRaises (AttributeError , lambda : rng .minutes )
@@ -509,6 +509,10 @@ def test_fields(self):
509509 tm .assert_series_equal (s .dt .seconds , Series (
510510 [10 * 3600 + 11 * 60 + 12 , np .nan ], index = [0 , 1 ]))
511511
512+ # preserve name (GH15589)
513+ rng .name = 'name'
514+ assert rng .days .name == 'name'
515+
512516 def test_freq_conversion (self ):
513517
514518 # doc example
0 commit comments