@@ -388,19 +388,11 @@ def test_td64arr_sub_period(self, box, freq):
388
388
with pytest .raises (TypeError ):
389
389
p - idx
390
390
391
- @pytest .mark .parametrize ('box' , [
392
- pd .Index ,
393
- Series ,
394
- pytest .param (pd .DataFrame ,
395
- marks = pytest .mark .xfail (reason = "broadcasts along "
396
- "wrong axis" ,
397
- raises = ValueError ,
398
- strict = True ))
399
- ], ids = lambda x : x .__name__ )
400
391
@pytest .mark .parametrize ('pi_freq' , ['D' , 'W' , 'Q' , 'H' ])
401
392
@pytest .mark .parametrize ('tdi_freq' , [None , 'H' ])
402
- def test_td64arr_sub_pi (self , box , tdi_freq , pi_freq ):
393
+ def test_td64arr_sub_pi (self , box_df_broadcast_failure , tdi_freq , pi_freq ):
403
394
# GH#20049 subtracting PeriodIndex should raise TypeError
395
+ box = box_df_broadcast_failure
404
396
tdi = TimedeltaIndex (['1 hours' , '2 hours' ], freq = tdi_freq )
405
397
dti = Timestamp ('2018-03-07 17:16:40' ) + tdi
406
398
pi = dti .to_period (pi_freq )
@@ -529,16 +521,9 @@ def test_td64arr_rsub_int_series_invalid(self, box, tdser):
529
521
with pytest .raises (err ):
530
522
Series ([2 , 3 , 4 ]) - tdser
531
523
532
- @pytest .mark .parametrize ('box' , [
533
- pd .Index ,
534
- Series ,
535
- pytest .param (pd .DataFrame ,
536
- marks = pytest .mark .xfail (reason = "Attempts to broadcast "
537
- "incorrectly" ,
538
- strict = True , raises = ValueError ))
539
- ], ids = lambda x : x .__name__ )
540
- def test_td64arr_add_intlike (self , box ):
524
+ def test_td64arr_add_intlike (self , box_df_broadcast_failure ):
541
525
# GH#19123
526
+ box = box_df_broadcast_failure
542
527
tdi = TimedeltaIndex (['59 days' , '59 days' , 'NaT' ])
543
528
ser = tm .box_expected (tdi , box )
544
529
err = TypeError if box is not pd .Index else NullFrequencyError
@@ -706,21 +691,13 @@ def test_td64arr_sub_td64_array(self, box_df_broadcast_failure):
706
691
tm .assert_equal (result , expected )
707
692
708
693
# TODO: parametrize over [add, sub, radd, rsub]?
709
- @pytest .mark .parametrize ('box' , [
710
- pd .Index ,
711
- Series ,
712
- pytest .param (pd .DataFrame ,
713
- marks = pytest .mark .xfail (reason = "Tries to broadcast "
714
- "incorrectly leading "
715
- "to alignment error" ,
716
- strict = True , raises = ValueError ))
717
- ], ids = lambda x : x .__name__ )
718
694
@pytest .mark .parametrize ('names' , [(None , None , None ),
719
695
('Egon' , 'Venkman' , None ),
720
696
('NCC1701D' , 'NCC1701D' , 'NCC1701D' )])
721
- def test_td64arr_add_sub_tdi (self , box , names ):
697
+ def test_td64arr_add_sub_tdi (self , box_df_broadcast_failure , names ):
722
698
# GH#17250 make sure result dtype is correct
723
699
# GH#19043 make sure names are propagated correctly
700
+ box = box_df_broadcast_failure
724
701
tdi = TimedeltaIndex (['0 days' , '1 day' ], name = names [0 ])
725
702
ser = Series ([Timedelta (hours = 3 ), Timedelta (hours = 4 )], name = names [1 ])
726
703
expected = Series ([Timedelta (hours = 3 ), Timedelta (days = 1 , hours = 4 )],
@@ -830,19 +807,12 @@ def test_timedelta64_operations_with_DateOffset(self):
830
807
td - op (5 )
831
808
op (5 ) - td
832
809
833
- @pytest .mark .parametrize ('box' , [
834
- pd .Index ,
835
- Series ,
836
- pytest .param (pd .DataFrame ,
837
- marks = pytest .mark .xfail (reason = "Tries to broadcast "
838
- "incorrectly" ,
839
- strict = True , raises = ValueError ))
840
- ], ids = lambda x : x .__name__ )
841
810
@pytest .mark .parametrize ('names' , [(None , None , None ),
842
811
('foo' , 'bar' , None ),
843
812
('foo' , 'foo' , 'foo' )])
844
- def test_td64arr_add_offset_index (self , names , box ):
813
+ def test_td64arr_add_offset_index (self , names , box_df_broadcast_failure ):
845
814
# GH#18849, GH#19744
815
+ box = box_df_broadcast_failure
846
816
tdi = TimedeltaIndex (['1 days 00:00:00' , '3 days 04:00:00' ],
847
817
name = names [0 ])
848
818
other = pd .Index ([pd .offsets .Hour (n = 1 ), pd .offsets .Minute (n = - 2 )],
0 commit comments