MCPcopy
hub / github.com/pandas-dev/pandas / test_add

Function test_add

pandas/tests/arithmetic/test_string.py:210–234  ·  view source on GitHub ↗
(any_string_dtype, request)

Source from the content-addressed store, hash-verified

208
209
210def test_add(any_string_dtype, request):
211 dtype = any_string_dtype
212 if dtype == object:
213 mark = pytest.mark.xfail(
214 reason="Need to update expected for numpy object dtype"
215 )
216 request.applymarker(mark)
217
218 a = Series(["a", "b", "c", None, None], dtype=dtype)
219 b = Series(["x", "y", None, "z", None], dtype=dtype)
220
221 result = a + b
222 expected = Series(["ax", "by", None, None, None], dtype=dtype)
223 tm.assert_series_equal(result, expected)
224
225 result = a.add(b)
226 tm.assert_series_equal(result, expected)
227
228 result = a.radd(b)
229 expected = Series(["xa", "yb", None, None, None], dtype=dtype)
230 tm.assert_series_equal(result, expected)
231
232 result = a.add(b, fill_value="-")
233 expected = Series(["ax", "by", "c-", "-z", None], dtype=dtype)
234 tm.assert_series_equal(result, expected)
235
236
237def test_add_2d(any_string_dtype, request):

Callers

nothing calls this directly

Calls 3

addMethod · 0.95
raddMethod · 0.95
SeriesClass · 0.90

Tested by

no test coverage detected