Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pandas/tests/extension/base/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def test_fillna_series(self, data_missing):
ser = pd.Series(data_missing)

result = ser.fillna(fill_value)
expected = pd.Series(type(data_missing)([fill_value, fill_value]))
expected = pd.Series(
data_missing._constructor_from_sequence([fill_value, fill_value]))
self.assert_series_equal(result, expected)

# Fill with a series
Expand All @@ -89,7 +90,8 @@ def test_fillna_series_method(self, data_missing, method):
data_missing = type(data_missing)(data_missing[::-1])

result = pd.Series(data_missing).fillna(method=method)
expected = pd.Series(type(data_missing)([fill_value, fill_value]))
expected = pd.Series(
data_missing._constructor_from_sequence([fill_value, fill_value]))

self.assert_series_equal(result, expected)

Expand All @@ -102,7 +104,8 @@ def test_fillna_frame(self, data_missing):
}).fillna(fill_value)

expected = pd.DataFrame({
"A": type(data_missing)([fill_value, fill_value]),
"A": data_missing._constructor_from_sequence(
[fill_value, fill_value]),
"B": [1, 2],
})

Expand Down
10 changes: 6 additions & 4 deletions pandas/tests/extension/base/reshaping.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_align(self, data, na_value):
r1, r2 = pd.Series(a).align(pd.Series(b, index=[1, 2, 3]))

# Assumes that the ctor can take a list of scalars of the type
e1 = pd.Series(type(data)(list(a) + [na_value]))
e2 = pd.Series(type(data)([na_value] + list(b)))
e1 = pd.Series(data._constructor_from_sequence(list(a) + [na_value]))
e2 = pd.Series(data._constructor_from_sequence([na_value] + list(b)))
self.assert_series_equal(r1, e1)
self.assert_series_equal(r2, e2)

Expand All @@ -60,8 +60,10 @@ def test_align_frame(self, data, na_value):
)

# Assumes that the ctor can take a list of scalars of the type
e1 = pd.DataFrame({'A': type(data)(list(a) + [na_value])})
e2 = pd.DataFrame({'A': type(data)([na_value] + list(b))})
e1 = pd.DataFrame(
{'A': data._constructor_from_sequence(list(a) + [na_value])})
e2 = pd.DataFrame(
{'A': data._constructor_from_sequence([na_value] + list(b))})
self.assert_frame_equal(r1, e1)
self.assert_frame_equal(r2, e2)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/base/setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_setitem_sequence_mismatched_length_raises(self, data, as_array):
ser = pd.Series(data)
value = [data[0]]
if as_array:
value = type(data)(value)
value = data._constructor_from_sequence(value)

xpr = 'cannot set using a {} indexer with a different length'
with tm.assert_raises_regex(ValueError, xpr.format('list-like')):
Expand Down