1515
1616
1717class TestTimedeltaIndex :
18- def test_closed_deprecated (self ):
19- # GH#52628
20- msg = "The 'closed' keyword"
21- with tm .assert_produces_warning (FutureWarning , match = msg ):
22- TimedeltaIndex ([], closed = True )
23-
2418 def test_array_of_dt64_nat_raises (self ):
2519 # GH#39462
2620 nat = np .datetime64 ("NaT" , "ns" )
@@ -36,14 +30,6 @@ def test_array_of_dt64_nat_raises(self):
3630 with pytest .raises (TypeError , match = msg ):
3731 to_timedelta (arr )
3832
39- @pytest .mark .parametrize ("unit" , ["Y" , "y" , "M" ])
40- def test_unit_m_y_raises (self , unit ):
41- msg = "Units 'M', 'Y', and 'y' are no longer supported"
42- depr_msg = "The 'unit' keyword in TimedeltaIndex construction is deprecated"
43- with pytest .raises (ValueError , match = msg ):
44- with tm .assert_produces_warning (FutureWarning , match = depr_msg ):
45- TimedeltaIndex ([1 , 3 , 7 ], unit )
46-
4733 def test_int64_nocopy (self ):
4834 # GH#23539 check that a copy isn't made when we pass int64 data
4935 # and copy=False
@@ -138,9 +124,6 @@ def test_construction_base_constructor(self):
138124 tm .assert_index_equal (pd .Index (arr ), TimedeltaIndex (arr ))
139125 tm .assert_index_equal (pd .Index (np .array (arr )), TimedeltaIndex (np .array (arr )))
140126
141- @pytest .mark .filterwarnings (
142- "ignore:The 'unit' keyword in TimedeltaIndex construction:FutureWarning"
143- )
144127 def test_constructor (self ):
145128 expected = TimedeltaIndex (
146129 [
@@ -162,22 +145,6 @@ def test_constructor(self):
162145 )
163146 tm .assert_index_equal (result , expected )
164147
165- expected = TimedeltaIndex (
166- ["0 days 00:00:00" , "0 days 00:00:01" , "0 days 00:00:02" ]
167- )
168- result = TimedeltaIndex (range (3 ), unit = "s" )
169- tm .assert_index_equal (result , expected )
170- expected = TimedeltaIndex (
171- ["0 days 00:00:00" , "0 days 00:00:05" , "0 days 00:00:09" ]
172- )
173- result = TimedeltaIndex ([0 , 5 , 9 ], unit = "s" )
174- tm .assert_index_equal (result , expected )
175- expected = TimedeltaIndex (
176- ["0 days 00:00:00.400" , "0 days 00:00:00.450" , "0 days 00:00:01.200" ]
177- )
178- result = TimedeltaIndex ([400 , 450 , 1200 ], unit = "ms" )
179- tm .assert_index_equal (result , expected )
180-
181148 def test_constructor_iso (self ):
182149 # GH #21877
183150 expected = timedelta_range ("1s" , periods = 9 , freq = "s" )
0 commit comments