@@ -83,24 +83,27 @@ def test_unparseable_strings_with_dt64_dtype(self):
8383 # test for None or an empty generator.
8484 # test_constructor_pass_none tests None but only with the index also
8585 # passed.
86- (lambda : Series (), True ),
87- (lambda : Series (None ), True ),
88- (lambda : Series ({}), True ),
89- (lambda : Series (()), False ), # creates a RangeIndex
90- (lambda : Series ([]), False ), # creates a RangeIndex
91- (lambda : Series (_ for _ in []), False ), # creates a RangeIndex
92- (lambda : Series (data = None ), True ),
93- (lambda : Series (data = {}), True ),
94- (lambda : Series (data = ()), False ), # creates a RangeIndex
95- (lambda : Series (data = []), False ), # creates a RangeIndex
96- (lambda : Series (data = (_ for _ in [])), False ), # creates a RangeIndex
86+ (lambda idx : Series (index = idx ), True ),
87+ (lambda idx : Series (None , index = idx ), True ),
88+ (lambda idx : Series ({}, index = idx ), True ),
89+ (lambda idx : Series ((), index = idx ), False ), # creates a RangeIndex
90+ (lambda idx : Series ([], index = idx ), False ), # creates a RangeIndex
91+ (lambda idx : Series (( _ for _ in []), index = idx ), False ), # RangeIndex
92+ (lambda idx : Series (data = None , index = idx ), True ),
93+ (lambda idx : Series (data = {}, index = idx ), True ),
94+ (lambda idx : Series (data = (), index = idx ), False ), # creates a RangeIndex
95+ (lambda idx : Series (data = [], index = idx ), False ), # creates a RangeIndex
96+ (lambda idx : Series (data = (_ for _ in []), index = idx ), False ), # RangeIndex
9797 ],
9898 )
99- def test_empty_constructor (self , constructor , check_index_type ):
99+ @pytest .mark .parametrize ("empty_index" , [None , []])
100+ def test_empty_constructor (self , constructor , check_index_type , empty_index ):
100101 # TODO: share with frame test of the same name
101- expected = Series ()
102- result = constructor ()
102+ # GH 49573 (addition of empty_index parameter)
103+ expected = Series (index = empty_index )
104+ result = constructor (empty_index )
103105
106+ assert result .dtype == object
104107 assert len (result .index ) == 0
105108 tm .assert_series_equal (result , expected , check_index_type = check_index_type )
106109
0 commit comments