@@ -355,13 +355,15 @@ def test_subtraction_ops(self):
355
355
expected = DatetimeIndex (["20121231" , NaT , "20121230" ], name = "foo" )
356
356
tm .assert_index_equal (result , expected )
357
357
358
- def test_subtraction_ops_with_tz (self ):
358
+ def test_subtraction_ops_with_tz (self , box_with_array ):
359
359
360
360
# check that dt/dti subtraction ops with tz are validated
361
361
dti = pd .date_range ("20130101" , periods = 3 )
362
+ dti = tm .box_expected (dti , box_with_array )
362
363
ts = Timestamp ("20130101" )
363
364
dt = ts .to_pydatetime ()
364
365
dti_tz = pd .date_range ("20130101" , periods = 3 ).tz_localize ("US/Eastern" )
366
+ dti_tz = tm .box_expected (dti_tz , box_with_array )
365
367
ts_tz = Timestamp ("20130101" ).tz_localize ("US/Eastern" )
366
368
ts_tz2 = Timestamp ("20130101" ).tz_localize ("CET" )
367
369
dt_tz = ts_tz .to_pydatetime ()
@@ -412,27 +414,32 @@ def _check(result, expected):
412
414
413
415
result = dti_tz - dt_tz
414
416
expected = TimedeltaIndex (["0 days" , "1 days" , "2 days" ])
415
- tm .assert_index_equal (result , expected )
417
+ expected = tm .box_expected (expected , box_with_array )
418
+ tm .assert_equal (result , expected )
416
419
417
420
result = dt_tz - dti_tz
418
421
expected = TimedeltaIndex (["0 days" , "-1 days" , "-2 days" ])
419
- tm .assert_index_equal (result , expected )
422
+ expected = tm .box_expected (expected , box_with_array )
423
+ tm .assert_equal (result , expected )
420
424
421
425
result = dti_tz - ts_tz
422
426
expected = TimedeltaIndex (["0 days" , "1 days" , "2 days" ])
423
- tm .assert_index_equal (result , expected )
427
+ expected = tm .box_expected (expected , box_with_array )
428
+ tm .assert_equal (result , expected )
424
429
425
430
result = ts_tz - dti_tz
426
431
expected = TimedeltaIndex (["0 days" , "-1 days" , "-2 days" ])
427
- tm .assert_index_equal (result , expected )
432
+ expected = tm .box_expected (expected , box_with_array )
433
+ tm .assert_equal (result , expected )
428
434
429
435
result = td - td
430
436
expected = Timedelta ("0 days" )
431
437
_check (result , expected )
432
438
433
439
result = dti_tz - td
434
440
expected = DatetimeIndex (["20121231" , "20130101" , "20130102" ], tz = "US/Eastern" )
435
- tm .assert_index_equal (result , expected )
441
+ expected = tm .box_expected (expected , box_with_array )
442
+ tm .assert_equal (result , expected )
436
443
437
444
def test_dti_tdi_numeric_ops (self ):
438
445
# These are normally union/diff set-like ops
0 commit comments