From d4bacd984de676ce9970ce5aa9a7e76eea8bb341 Mon Sep 17 00:00:00 2001 From: "Joshua B. Smith" Date: Tue, 1 Oct 2019 13:04:32 -0400 Subject: [PATCH 1/2] Added test to confirm fix for #28658 adds a test to check for regressions later. --- pandas/tests/series/test_arithmetic.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pandas/tests/series/test_arithmetic.py b/pandas/tests/series/test_arithmetic.py index 89557445cafb4..e62f1ae663778 100644 --- a/pandas/tests/series/test_arithmetic.py +++ b/pandas/tests/series/test_arithmetic.py @@ -66,6 +66,21 @@ def test_add_series_with_period_index(self): with pytest.raises(IncompatibleFrequency, match=msg): ts + ts.asfreq("D", how="end") + @pytest.mark.parametrize( + "target_add,input_value,expected_value", + [ + ("!", ["hello", "world"], ["hello!", "world!"]), + ("m", ["hello", "world"], ["hellom", "worldm"]), + ], + ) + def test_string_addition(self, target_add, input_value, expected_value): + # GH28658 + a = Series(input_value) + + result = a + target_add + expected = Series(expected_value) + tm.assert_series_equal(result, expected) + # ------------------------------------------------------------------ # Comparisons From 6d520914b5f01ef6bd02a022cfc06e1a0eedbd3e Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 2 Oct 2019 08:42:39 +0200 Subject: [PATCH 2/2] Update test_arithmetic.py --- pandas/tests/series/test_arithmetic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/series/test_arithmetic.py b/pandas/tests/series/test_arithmetic.py index e62f1ae663778..68d6169fa4f34 100644 --- a/pandas/tests/series/test_arithmetic.py +++ b/pandas/tests/series/test_arithmetic.py @@ -74,7 +74,7 @@ def test_add_series_with_period_index(self): ], ) def test_string_addition(self, target_add, input_value, expected_value): - # GH28658 + # GH28658 - ensure adding 'm' does not raise an error a = Series(input_value) result = a + target_add