@@ -162,10 +162,11 @@ def test_str_cat_raises_intuitive_error(self, box):
162
162
with tm .assert_raises_regex (ValueError , message ):
163
163
s .str .cat (' ' )
164
164
165
+ @pytest .mark .parametrize ('sep' , ['' , None ])
165
166
@pytest .mark .parametrize ('dtype_target' , ['object' , 'category' ])
166
167
@pytest .mark .parametrize ('dtype_caller' , ['object' , 'category' ])
167
168
@pytest .mark .parametrize ('box' , [Series , Index ])
168
- def test_str_cat_categorical (self , box , dtype_caller , dtype_target ):
169
+ def test_str_cat_categorical (self , box , dtype_caller , dtype_target , sep ):
169
170
s = Index (['a' , 'a' , 'b' , 'a' ], dtype = dtype_caller )
170
171
s = s if box == Index else Series (s , index = s )
171
172
t = Index (['b' , 'a' , 'b' , 'c' ], dtype = dtype_target )
@@ -176,23 +177,23 @@ def test_str_cat_categorical(self, box, dtype_caller, dtype_target):
176
177
# Series/Index with unaligned Index
177
178
with tm .assert_produces_warning (expected_warning = FutureWarning ):
178
179
# FutureWarning to switch to alignment by default
179
- result = s .str .cat (t )
180
+ result = s .str .cat (t , sep = sep )
180
181
assert_series_or_index_equal (result , expected )
181
182
182
183
# Series/Index with Series having matching Index
183
184
t = Series (t , index = s )
184
- result = s .str .cat (t )
185
+ result = s .str .cat (t , sep = sep )
185
186
assert_series_or_index_equal (result , expected )
186
187
187
188
# Series/Index with Series.values
188
- result = s .str .cat (t .values )
189
+ result = s .str .cat (t .values , sep = sep )
189
190
assert_series_or_index_equal (result , expected )
190
191
191
192
# Series/Index with Series having different Index
192
193
t = Series (t .values , index = t )
193
194
with tm .assert_produces_warning (expected_warning = FutureWarning ):
194
195
# FutureWarning to switch to alignment by default
195
- result = s .str .cat (t )
196
+ result = s .str .cat (t , sep = sep )
196
197
assert_series_or_index_equal (result , expected )
197
198
198
199
@pytest .mark .parametrize ('box' , [Series , Index ])
0 commit comments