diff --git a/pandas/tests/series/methods/test_combine.py b/pandas/tests/series/methods/test_combine.py index 75d47e3daa103..2c102accdf626 100644 --- a/pandas/tests/series/methods/test_combine.py +++ b/pandas/tests/series/methods/test_combine.py @@ -1,12 +1,13 @@ -from pandas import Series +from pandas import ( + NA, + Series, +) import pandas._testing as tm class TestCombine: def test_combine_scalar(self): # GH#21248 - # Note - combine() with another Series is tested elsewhere because - # it is used when testing operators ser = Series([i * 10 for i in range(5)]) result = ser.combine(3, lambda x, y: x + y) expected = Series([i * 10 + 3 for i in range(5)]) @@ -15,3 +16,13 @@ def test_combine_scalar(self): result = ser.combine(22, lambda x, y: min(x, y)) expected = Series([min(i * 10, 22) for i in range(5)]) tm.assert_series_equal(result, expected) + + def test_combine_series(self): + # GH#31899 + # Note - combine() with another Series is also tested elsewhere because + # it is used when testing operators + s1 = Series([91, NA, 94], dtype="Int8") + s2 = Series([91, NA, 11], dtype="Int8") + result = s1.combine(s2, lambda x, y: x + y) + expected = Series([-74, NA, 105], dtype="Int8") # dtype should be preserved + tm.assert_series_equal(result, expected)