Skip to content

Commit ed0b679

Browse files
committed
tests for creating series string dtype
More specifically the cases that seem to have an issue are when: - the series in empty - it's a single element series
1 parent 98fb53c commit ed0b679

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/series/test_constructors.py

+8
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ def test_constructor_no_data_index_order(self):
137137
result = pd.Series(index=['b', 'a', 'c'])
138138
assert result.index.tolist() == ['b', 'a', 'c']
139139

140+
def test_constructor_no_data_string_type(self):
141+
result = pd.Series(index=[1], dtype=str)
142+
assert result.isna().all()
143+
144+
def test_constructor_single_element_string_type(self):
145+
result = pd.Series(13, index=[1], dtype=str)
146+
assert result.values.tolist() == ['13']
147+
140148
def test_constructor_dtype_str_na_values(self, string_dtype):
141149
# https://github.com/pandas-dev/pandas/issues/21083
142150
ser = Series(['x', None], dtype=string_dtype)

0 commit comments

Comments
 (0)