@@ -127,40 +127,37 @@ def test_constructor_empty(self, input_class):
127
127
with tm .assert_produces_warning (DeprecationWarning , check_stacklevel = False ):
128
128
empty = Series ()
129
129
empty2 = Series (input_class ())
130
- tm .assert_series_equal (empty , empty2 )
131
- assert type (empty .index ) is Index
130
+
131
+ # these are Index() and RangeIndex() which don't compare type equal
132
+ # but are just .equals
133
+ tm .assert_series_equal (empty , empty2 , check_index_type = False )
132
134
133
135
# With explicit dtype:
134
136
empty = Series (dtype = "float64" )
135
137
empty2 = Series (input_class (), dtype = "float64" )
136
- tm .assert_series_equal (empty , empty2 )
137
- assert type (empty .index ) is Index
138
+ tm .assert_series_equal (empty , empty2 , check_index_type = False )
138
139
139
140
# GH 18515 : with dtype=category:
140
141
empty = Series (dtype = "category" )
141
142
empty2 = Series (input_class (), dtype = "category" )
142
- tm .assert_series_equal (empty , empty2 )
143
- assert type (empty .index ) is Index
143
+ tm .assert_series_equal (empty , empty2 , check_index_type = False )
144
144
145
145
if input_class is not list :
146
146
# With index:
147
147
with tm .assert_produces_warning (DeprecationWarning , check_stacklevel = False ):
148
148
empty = Series (index = range (10 ))
149
149
empty2 = Series (input_class (), index = range (10 ))
150
150
tm .assert_series_equal (empty , empty2 )
151
- assert type (empty .index ) is pd .RangeIndex
152
151
153
152
# With index and dtype float64:
154
153
empty = Series (np .nan , index = range (10 ))
155
154
empty2 = Series (input_class (), index = range (10 ), dtype = "float64" )
156
155
tm .assert_series_equal (empty , empty2 )
157
- assert type (empty .index ) is pd .RangeIndex
158
156
159
157
# GH 19853 : with empty string, index and dtype str
160
158
empty = Series ("" , dtype = str , index = range (3 ))
161
159
empty2 = Series ("" , index = range (3 ))
162
160
tm .assert_series_equal (empty , empty2 )
163
- assert type (empty .index ) is pd .RangeIndex
164
161
165
162
@pytest .mark .parametrize ("input_arg" , [np .nan , float ("nan" )])
166
163
def test_constructor_nan (self , input_arg ):
0 commit comments