@@ -607,29 +607,6 @@ def test_td64_series_assign_nat(nat_val, should_cast):
607607 tm .assert_series_equal (ser , expected )
608608
609609
610- @pytest .mark .parametrize (
611- "td" ,
612- [
613- Timedelta ("9 days" ),
614- Timedelta ("9 days" ).to_timedelta64 (),
615- Timedelta ("9 days" ).to_pytimedelta (),
616- ],
617- )
618- def test_append_timedelta_does_not_cast (td ):
619- # GH#22717 inserting a Timedelta should _not_ cast to int64
620- expected = Series (["x" , td ], index = [0 , "td" ], dtype = object )
621-
622- ser = Series (["x" ])
623- ser ["td" ] = td
624- tm .assert_series_equal (ser , expected )
625- assert isinstance (ser ["td" ], Timedelta )
626-
627- ser = Series (["x" ])
628- ser .loc ["td" ] = Timedelta ("9 days" )
629- tm .assert_series_equal (ser , expected )
630- assert isinstance (ser ["td" ], Timedelta )
631-
632-
633610def test_underlying_data_conversion ():
634611 # GH 4080
635612 df = DataFrame ({c : [1 , 2 , 3 ] for c in ["a" , "b" , "c" ]})
@@ -759,15 +736,11 @@ def test_getitem_unrecognized_scalar():
759736 timedelta_range ("0" , periods = 20 , freq = "H" ),
760737 ],
761738)
762- def test_slice_with_zero_step_raises (index ):
763- ts = Series (np .arange (20 ), index )
739+ def test_slice_with_zero_step_raises (index , frame_or_series , indexer_sli ):
740+ ts = frame_or_series (np .arange (20 ), index = index )
764741
765742 with pytest .raises (ValueError , match = "slice step cannot be zero" ):
766- ts [::0 ]
767- with pytest .raises (ValueError , match = "slice step cannot be zero" ):
768- ts .loc [::0 ]
769- with pytest .raises (ValueError , match = "slice step cannot be zero" ):
770- ts .iloc [::0 ]
743+ indexer_sli (ts )[::0 ]
771744
772745
773746@pytest .mark .parametrize (
@@ -784,7 +757,6 @@ def assert_slices_equivalent(l_slc, i_slc):
784757
785758 tm .assert_series_equal (ts [l_slc ], expected )
786759 tm .assert_series_equal (ts .loc [l_slc ], expected )
787- tm .assert_series_equal (ts .loc [l_slc ], expected )
788760
789761 keystr1 = str (index [9 ])
790762 keystr2 = str (index [13 ])
0 commit comments