@@ -101,6 +101,36 @@ def test_empty_constructor(self, constructor, check_index_type):
101
101
expected = Series ()
102
102
result = constructor ()
103
103
104
+ assert result .dtype == object
105
+ assert len (result .index ) == 0
106
+ tm .assert_series_equal (result , expected , check_index_type = check_index_type )
107
+
108
+ @pytest .mark .parametrize (
109
+ "constructor,check_index_type" ,
110
+ [
111
+ # NOTE: some overlap with test_constructor_empty but that test does not
112
+ # test for None or an empty generator.
113
+ # test_constructor_pass_none tests None but only with the index also
114
+ # passed.
115
+ (lambda : Series (index = []), True ),
116
+ (lambda : Series (None , index = []), True ),
117
+ (lambda : Series ({}, index = []), True ),
118
+ (lambda : Series ((), index = []), False ), # creates a RangeIndex
119
+ (lambda : Series ([], index = []), False ), # creates a RangeIndex
120
+ (lambda : Series ((_ for _ in []), index = []), False ), # creates a RangeIndex
121
+ (lambda : Series (data = None , index = []), True ),
122
+ (lambda : Series (data = {}, index = []), True ),
123
+ (lambda : Series (data = (), index = []), False ), # creates a RangeIndex
124
+ (lambda : Series (data = [], index = []), False ), # creates a RangeIndex
125
+ (lambda : Series (data = (_ for _ in []), index = []), False ), # RangeIndex
126
+ ],
127
+ )
128
+ def test_empty_constructor_with_index (self , constructor , check_index_type ):
129
+ # GH 49573
130
+ expected = Series ()
131
+ result = constructor ()
132
+
133
+ assert result .dtype == object
104
134
assert len (result .index ) == 0
105
135
tm .assert_series_equal (result , expected , check_index_type = check_index_type )
106
136
0 commit comments