@@ -309,7 +309,7 @@ def test_ufunc_coercions(self):
309
309
tm .assert_index_equal (result , exp )
310
310
assert result .freq is None
311
311
312
- def test_subtraction_ops (self ):
312
+ def test_subtraction_ops (self , box_with_array ):
313
313
# with datetimes/timedelta and tdi/dti
314
314
tdi = TimedeltaIndex (["1 days" , pd .NaT , "2 days" ], name = "foo" )
315
315
dti = pd .date_range ("20130101" , periods = 3 , name = "bar" )
@@ -356,13 +356,15 @@ def test_subtraction_ops(self):
356
356
expected = DatetimeIndex (["20121231" , pd .NaT , "20121230" ], name = "foo" )
357
357
tm .assert_index_equal (result , expected )
358
358
359
- def test_subtraction_ops_with_tz (self ):
359
+ def test_subtraction_ops_with_tz (self , box_with_array ):
360
360
361
361
# check that dt/dti subtraction ops with tz are validated
362
362
dti = pd .date_range ("20130101" , periods = 3 )
363
+ dti = tm .box_expected (dti , box_with_array )
363
364
ts = Timestamp ("20130101" )
364
365
dt = ts .to_pydatetime ()
365
366
dti_tz = pd .date_range ("20130101" , periods = 3 ).tz_localize ("US/Eastern" )
367
+ dti_tz = tm .box_expected (dti_tz , box_with_array )
366
368
ts_tz = Timestamp ("20130101" ).tz_localize ("US/Eastern" )
367
369
ts_tz2 = Timestamp ("20130101" ).tz_localize ("CET" )
368
370
dt_tz = ts_tz .to_pydatetime ()
@@ -428,37 +430,44 @@ def _check(result, expected):
428
430
expected = TimedeltaIndex (
429
431
["0 days 06:00:00" , "1 days 06:00:00" , "2 days 06:00:00" ]
430
432
)
431
- tm .assert_index_equal (result , expected )
433
+ expected = tm .box_expected (expected , box_with_array )
434
+ tm .assert_equal (result , expected )
432
435
433
436
result = ts_tz2 - dti_tz
434
437
expected = TimedeltaIndex (
435
438
["-1 days +18:00:00" , "-2 days +18:00:00" , "-3 days +18:00:00" ]
436
439
)
437
- tm .assert_index_equal (result , expected )
440
+ expected = tm .box_expected (expected , box_with_array )
441
+ tm .assert_equal (result , expected )
438
442
439
443
result = dti_tz - dt_tz
440
444
expected = TimedeltaIndex (["0 days" , "1 days" , "2 days" ])
441
- tm .assert_index_equal (result , expected )
445
+ expected = tm .box_expected (expected , box_with_array )
446
+ tm .assert_equal (result , expected )
442
447
443
448
result = dt_tz - dti_tz
444
449
expected = TimedeltaIndex (["0 days" , "-1 days" , "-2 days" ])
445
- tm .assert_index_equal (result , expected )
450
+ expected = tm .box_expected (expected , box_with_array )
451
+ tm .assert_equal (result , expected )
446
452
447
453
result = dti_tz - ts_tz
448
454
expected = TimedeltaIndex (["0 days" , "1 days" , "2 days" ])
449
- tm .assert_index_equal (result , expected )
455
+ expected = tm .box_expected (expected , box_with_array )
456
+ tm .assert_equal (result , expected )
450
457
451
458
result = ts_tz - dti_tz
452
459
expected = TimedeltaIndex (["0 days" , "-1 days" , "-2 days" ])
453
- tm .assert_index_equal (result , expected )
460
+ expected = tm .box_expected (expected , box_with_array )
461
+ tm .assert_equal (result , expected )
454
462
455
463
result = td - td
456
464
expected = Timedelta ("0 days" )
457
465
_check (result , expected )
458
466
459
467
result = dti_tz - td
460
468
expected = DatetimeIndex (["20121231" , "20130101" , "20130102" ], tz = "US/Eastern" )
461
- tm .assert_index_equal (result , expected )
469
+ expected = tm .box_expected (expected , box_with_array )
470
+ tm .assert_equal (result , expected )
462
471
463
472
def test_dti_tdi_numeric_ops (self ):
464
473
# These are normally union/diff set-like ops
0 commit comments