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