15
15
16
16
17
17
class 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
-
24
18
def test_array_of_dt64_nat_raises (self ):
25
19
# GH#39462
26
20
nat = np .datetime64 ("NaT" , "ns" )
@@ -36,14 +30,6 @@ def test_array_of_dt64_nat_raises(self):
36
30
with pytest .raises (TypeError , match = msg ):
37
31
to_timedelta (arr )
38
32
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
-
47
33
def test_int64_nocopy (self ):
48
34
# GH#23539 check that a copy isn't made when we pass int64 data
49
35
# and copy=False
@@ -138,9 +124,6 @@ def test_construction_base_constructor(self):
138
124
tm .assert_index_equal (pd .Index (arr ), TimedeltaIndex (arr ))
139
125
tm .assert_index_equal (pd .Index (np .array (arr )), TimedeltaIndex (np .array (arr )))
140
126
141
- @pytest .mark .filterwarnings (
142
- "ignore:The 'unit' keyword in TimedeltaIndex construction:FutureWarning"
143
- )
144
127
def test_constructor (self ):
145
128
expected = TimedeltaIndex (
146
129
[
@@ -162,22 +145,6 @@ def test_constructor(self):
162
145
)
163
146
tm .assert_index_equal (result , expected )
164
147
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
-
181
148
def test_constructor_iso (self ):
182
149
# GH #21877
183
150
expected = timedelta_range ("1s" , periods = 9 , freq = "s" )
0 commit comments