@@ -344,12 +344,14 @@ def test_subtraction_ops(self):
344
344
345
345
result = dti - td
346
346
expected = DatetimeIndex (
347
- ["20121231" , "20130101" , "20130102" ], freq = "D" , name = "bar"
347
+ ["20121231" , "20130101" , "20130102" ], dtype = "M8[ns]" , freq = "D" , name = "bar"
348
348
)
349
349
tm .assert_index_equal (result , expected )
350
350
351
351
result = dt - tdi
352
- expected = DatetimeIndex (["20121231" , NaT , "20121230" ], name = "foo" )
352
+ expected = DatetimeIndex (
353
+ ["20121231" , NaT , "20121230" ], dtype = "M8[ns]" , name = "foo"
354
+ )
353
355
tm .assert_index_equal (result , expected )
354
356
355
357
def test_subtraction_ops_with_tz (self , box_with_array ):
@@ -432,7 +434,9 @@ def _check(result, expected):
432
434
_check (result , expected )
433
435
434
436
result = dti_tz - td
435
- expected = DatetimeIndex (["20121231" , "20130101" , "20130102" ], tz = "US/Eastern" )
437
+ expected = DatetimeIndex (
438
+ ["20121231" , "20130101" , "20130102" ], tz = "US/Eastern"
439
+ ).as_unit ("ns" )
436
440
expected = tm .box_expected (expected , box_with_array )
437
441
tm .assert_equal (result , expected )
438
442
@@ -450,7 +454,7 @@ def test_dti_tdi_numeric_ops(self):
450
454
tm .assert_index_equal (result , expected )
451
455
452
456
result = dti - tdi # name will be reset
453
- expected = DatetimeIndex (["20121231" , NaT , "20130101" ])
457
+ expected = DatetimeIndex (["20121231" , NaT , "20130101" ], dtype = "M8[ns]" )
454
458
tm .assert_index_equal (result , expected )
455
459
456
460
def test_addition_ops (self ):
@@ -461,11 +465,15 @@ def test_addition_ops(self):
461
465
dt = Timestamp ("20130101" )
462
466
463
467
result = tdi + dt
464
- expected = DatetimeIndex (["20130102" , NaT , "20130103" ], name = "foo" )
468
+ expected = DatetimeIndex (
469
+ ["20130102" , NaT , "20130103" ], dtype = "M8[ns]" , name = "foo"
470
+ )
465
471
tm .assert_index_equal (result , expected )
466
472
467
473
result = dt + tdi
468
- expected = DatetimeIndex (["20130102" , NaT , "20130103" ], name = "foo" )
474
+ expected = DatetimeIndex (
475
+ ["20130102" , NaT , "20130103" ], dtype = "M8[ns]" , name = "foo"
476
+ )
469
477
tm .assert_index_equal (result , expected )
470
478
471
479
result = td + tdi
@@ -492,11 +500,11 @@ def test_addition_ops(self):
492
500
# pytest.raises(TypeError, lambda : Index([1,2,3]) + tdi)
493
501
494
502
result = tdi + dti # name will be reset
495
- expected = DatetimeIndex (["20130102" , NaT , "20130105" ])
503
+ expected = DatetimeIndex (["20130102" , NaT , "20130105" ], dtype = "M8[ns]" )
496
504
tm .assert_index_equal (result , expected )
497
505
498
506
result = dti + tdi # name will be reset
499
- expected = DatetimeIndex (["20130102" , NaT , "20130105" ])
507
+ expected = DatetimeIndex (["20130102" , NaT , "20130105" ], dtype = "M8[ns]" )
500
508
tm .assert_index_equal (result , expected )
501
509
502
510
result = dt + td
@@ -869,7 +877,7 @@ def test_operators_timedelta64(self):
869
877
# timestamp on lhs
870
878
result = resultb + df ["A" ]
871
879
values = [Timestamp ("20111230" ), Timestamp ("20120101" ), Timestamp ("20120103" )]
872
- expected = Series (values , name = "A" )
880
+ expected = Series (values , dtype = "M8[ns]" , name = "A" )
873
881
tm .assert_series_equal (result , expected )
874
882
875
883
# datetimes on rhs
0 commit comments