@@ -505,33 +505,25 @@ def test_tdi_add_dt64_array(self, box_df_broadcast_failure):
505
505
# ------------------------------------------------------------------
506
506
# Operations with int-like others
507
507
508
- def test_td64arr_add_int_series_invalid (self , box_df_broadcast_failure ,
509
- tdser ):
510
- box = box_df_broadcast_failure
508
+ def test_td64arr_add_int_series_invalid (self , box , tdser ):
511
509
tdser = tm .box_expected (tdser , box )
512
510
err = TypeError if box is not pd .Index else NullFrequencyError
513
511
with pytest .raises (err ):
514
512
tdser + Series ([2 , 3 , 4 ])
515
513
516
- def test_td64arr_radd_int_series_invalid (self , box_df_broadcast_failure ,
517
- tdser ):
518
- box = box_df_broadcast_failure
514
+ def test_td64arr_radd_int_series_invalid (self , box , tdser ):
519
515
tdser = tm .box_expected (tdser , box )
520
516
err = TypeError if box is not pd .Index else NullFrequencyError
521
517
with pytest .raises (err ):
522
518
Series ([2 , 3 , 4 ]) + tdser
523
519
524
- def test_td64arr_sub_int_series_invalid (self , box_df_broadcast_failure ,
525
- tdser ):
526
- box = box_df_broadcast_failure
520
+ def test_td64arr_sub_int_series_invalid (self , box , tdser ):
527
521
tdser = tm .box_expected (tdser , box )
528
522
err = TypeError if box is not pd .Index else NullFrequencyError
529
523
with pytest .raises (err ):
530
524
tdser - Series ([2 , 3 , 4 ])
531
525
532
- def test_td64arr_rsub_int_series_invalid (self , box_df_broadcast_failure ,
533
- tdser ):
534
- box = box_df_broadcast_failure
526
+ def test_td64arr_rsub_int_series_invalid (self , box , tdser ):
535
527
tdser = tm .box_expected (tdser , box )
536
528
err = TypeError if box is not pd .Index else NullFrequencyError
537
529
with pytest .raises (err ):
@@ -605,9 +597,10 @@ def test_td64arr_add_sub_numeric_scalar_invalid(self, box, scalar, tdser):
605
597
Series ([1 , 2 , 3 ])
606
598
# TODO: Add DataFrame in here?
607
599
], ids = lambda x : type (x ).__name__ )
608
- def test_td64arr_add_sub_numeric_arr_invalid (
609
- self , box_df_broadcast_failure , vec , dtype , tdser ):
610
- box = box_df_broadcast_failure
600
+ def test_td64arr_add_sub_numeric_arr_invalid (self , box , vec , dtype , tdser ):
601
+ if box is pd .DataFrame and not isinstance (vec , Series ):
602
+ raise pytest .xfail (reason = "Tries to broadcast incorrectly" )
603
+
611
604
tdser = tm .box_expected (tdser , box )
612
605
err = TypeError
613
606
if box is pd .Index and not dtype .startswith ('float' ):
@@ -930,9 +923,9 @@ def test_td64arr_sub_offset_array(self, box_df_broadcast_failure):
930
923
@pytest .mark .parametrize ('names' , [(None , None , None ),
931
924
('foo' , 'bar' , None ),
932
925
('foo' , 'foo' , 'foo' )])
933
- def test_td64arr_with_offset_series (self , names , box_df_broadcast_failure ):
926
+ def test_td64arr_with_offset_series (self , names , box_df_fail ):
934
927
# GH#18849
935
- box = box_df_broadcast_failure
928
+ box = box_df_fail
936
929
box2 = Series if box is pd .Index else box
937
930
938
931
tdi = TimedeltaIndex (['1 days 00:00:00' , '3 days 04:00:00' ],
@@ -963,10 +956,11 @@ def test_td64arr_with_offset_series(self, names, box_df_broadcast_failure):
963
956
tm .assert_equal (res3 , expected_sub )
964
957
965
958
@pytest .mark .parametrize ('obox' , [np .array , pd .Index , pd .Series ])
966
- def test_td64arr_addsub_anchored_offset_arraylike (
967
- self , obox , box_df_broadcast_failure ):
959
+ def test_td64arr_addsub_anchored_offset_arraylike (self , obox , box ):
968
960
# GH#18824
969
- box = box_df_broadcast_failure
961
+ if box is pd .DataFrame and obox is not pd .Series :
962
+ raise pytest .xfail (reason = "Attempts to broadcast incorrectly" )
963
+
970
964
tdi = TimedeltaIndex (['1 days 00:00:00' , '3 days 04:00:00' ])
971
965
tdi = tm .box_expected (tdi , box )
972
966
0 commit comments