@@ -148,17 +148,6 @@ def test_constructor_from_series_dtlike(self, index, has_tz):
148
148
if has_tz :
149
149
assert result .tz == index .tz
150
150
151
- @pytest .mark .parametrize ("klass" , [Index , DatetimeIndex ])
152
- def test_constructor_from_series (self , klass ):
153
- expected = DatetimeIndex (
154
- [Timestamp ("20110101" ), Timestamp ("20120101" ), Timestamp ("20130101" )]
155
- )
156
- s = Series (
157
- [Timestamp ("20110101" ), Timestamp ("20120101" ), Timestamp ("20130101" )]
158
- )
159
- result = klass (s )
160
- tm .assert_index_equal (result , expected )
161
-
162
151
def test_constructor_from_series_freq (self ):
163
152
# GH 6273
164
153
# create from a series, passing a freq
@@ -255,47 +244,6 @@ def test_index_ctor_infer_nan_nat(self, klass, dtype, na_val):
255
244
result = Index (np .array (na_list ))
256
245
tm .assert_index_equal (result , expected )
257
246
258
- @pytest .mark .parametrize ("pos" , [0 , 1 ])
259
- @pytest .mark .parametrize (
260
- "klass,dtype,ctor" ,
261
- [
262
- (pd .DatetimeIndex , "datetime64[ns]" , np .datetime64 ("nat" )),
263
- (pd .TimedeltaIndex , "timedelta64[ns]" , np .timedelta64 ("nat" )),
264
- ],
265
- )
266
- def test_index_ctor_infer_nat_dt_like (self , pos , klass , dtype , ctor , nulls_fixture ):
267
- expected = klass ([pd .NaT , pd .NaT ])
268
- assert expected .dtype == dtype
269
- data = [ctor ]
270
- data .insert (pos , nulls_fixture )
271
-
272
- if nulls_fixture is pd .NA :
273
- expected = Index ([pd .NA , pd .NaT ])
274
- pytest .xfail ("Broken with np.NaT ctor; see GH 31884" )
275
-
276
- result = Index (data )
277
- tm .assert_index_equal (result , expected )
278
-
279
- result = Index (np .array (data , dtype = object ))
280
- tm .assert_index_equal (result , expected )
281
-
282
- @pytest .mark .parametrize ("swap_objs" , [True , False ])
283
- def test_index_ctor_nat_result (self , swap_objs ):
284
- # mixed np.datetime64/timedelta64 nat results in object
285
- data = [np .datetime64 ("nat" ), np .timedelta64 ("nat" )]
286
- if swap_objs :
287
- data = data [::- 1 ]
288
-
289
- expected = pd .Index (data , dtype = object )
290
- tm .assert_index_equal (Index (data ), expected )
291
- tm .assert_index_equal (Index (np .array (data , dtype = object )), expected )
292
-
293
- def test_index_ctor_infer_periodindex (self ):
294
- xp = period_range ("2012-1-1" , freq = "M" , periods = 3 )
295
- rs = Index (xp )
296
- tm .assert_index_equal (rs , xp )
297
- assert isinstance (rs , PeriodIndex )
298
-
299
247
@pytest .mark .parametrize (
300
248
"vals,dtype" ,
301
249
[
0 commit comments