From 49f598053e89844d7cc0ba61822b796a8fe2f45b Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Sun, 28 Jun 2020 20:10:35 +0100 Subject: [PATCH 1/2] CI: troubleshoot --- pandas/tests/arithmetic/test_datetime64.py | 1 + pandas/tests/arithmetic/test_numeric.py | 6 ++++-- pandas/tests/arithmetic/test_period.py | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index b3f4d5f5d9ee5..fb725b5ce47ed 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1046,6 +1046,7 @@ def test_dt64arr_add_sub_invalid(self, dti_freq, other, box_with_array): "cannot (add|subtract)", "cannot use operands with types", "ufunc '?(add|subtract)'? cannot use operands with types", + "Concatenation operation is not implemented for NumPy arrays" ] ) assert_invalid_addsub_type(dtarr, other, msg) diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index a37339c66bf6e..2155846b271fc 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -234,7 +234,8 @@ def test_add_sub_timedeltalike_invalid(self, numeric_idx, other, box): "unsupported operand type|" "Addition/subtraction of integers and integer-arrays|" "Instead of adding/subtracting|" - "cannot use operands with types dtype" + "cannot use operands with types dtype|" + "Concatenation operation is not implemented for NumPy arrays" ) with pytest.raises(TypeError, match=msg): left + other @@ -263,7 +264,8 @@ def test_add_sub_datetimelike_invalid(self, numeric_idx, other, box): msg = ( "unsupported operand type|" "Cannot (add|subtract) NaT (to|from) ndarray|" - "Addition/subtraction of integers and integer-arrays" + "Addition/subtraction of integers and integer-arrays|" + "Concatenation operation is not implemented for NumPy arrays" ) with pytest.raises(TypeError, match=msg): left + other diff --git a/pandas/tests/arithmetic/test_period.py b/pandas/tests/arithmetic/test_period.py index 6c7b989bb9f2e..930435074efc1 100644 --- a/pandas/tests/arithmetic/test_period.py +++ b/pandas/tests/arithmetic/test_period.py @@ -682,7 +682,11 @@ def test_parr_add_sub_float_raises(self, op, other, box_with_array): dti = pd.DatetimeIndex(["2011-01-01", "2011-01-02"], freq="D") pi = dti.to_period("D") pi = tm.box_expected(pi, box_with_array) - msg = r"unsupported operand type\(s\) for [+-]: .* and .*" + msg = ( + r"unsupported operand type\(s\) for [+-]: .* and .*|" + "Concatenation operation is not implemented for NumPy arrays" + ) + with pytest.raises(TypeError, match=msg): op(pi, other) From 3570de28d80e9f20a4d01d7df4300c907449edbe Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Sun, 28 Jun 2020 20:42:38 +0100 Subject: [PATCH 2/2] test_ops_ndarray + lint fixup --- pandas/tests/arithmetic/test_datetime64.py | 2 +- pandas/tests/scalar/timedelta/test_arithmetic.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index fb725b5ce47ed..5dfaea7c77420 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1046,7 +1046,7 @@ def test_dt64arr_add_sub_invalid(self, dti_freq, other, box_with_array): "cannot (add|subtract)", "cannot use operands with types", "ufunc '?(add|subtract)'? cannot use operands with types", - "Concatenation operation is not implemented for NumPy arrays" + "Concatenation operation is not implemented for NumPy arrays", ] ) assert_invalid_addsub_type(dtarr, other, msg) diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index 2114962cfc0bd..cb33f99d9bd91 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -263,7 +263,10 @@ def test_ops_ndarray(self): msg = r"unsupported operand type\(s\) for \+: 'Timedelta' and 'int'" with pytest.raises(TypeError, match=msg): td + np.array([1]) - msg = r"unsupported operand type\(s\) for \+: 'numpy.ndarray' and 'Timedelta'" + msg = ( + r"unsupported operand type\(s\) for \+: 'numpy.ndarray' and 'Timedelta'|" + "Concatenation operation is not implemented for NumPy arrays" + ) with pytest.raises(TypeError, match=msg): np.array([1]) + td