From aa5dc3b1e8e394a04add66c196c1f61fa437359d Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 1 Feb 2020 15:36:00 +0200 Subject: [PATCH 01/19] TST: Added regression test --- pandas/tests/frame/test_timeseries.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pandas/tests/frame/test_timeseries.py b/pandas/tests/frame/test_timeseries.py index 5e06b6402c34f..20a729f5cb4c1 100644 --- a/pandas/tests/frame/test_timeseries.py +++ b/pandas/tests/frame/test_timeseries.py @@ -21,6 +21,21 @@ import pandas.tseries.offsets as offsets +def test_no_idea_how_to_name_this_or_where_to_place_this(): + # https://github.com/pandas-dev/pandas/issues/10329 + df = pd.DataFrame( + { + "date": pd.date_range("2012-01-01", periods=3), + "time": [time(i, i, i) for i in range(3)], + } + ) + + msg = "unsupported operand type\(s\) for -: 'Timestamp' and 'datetime.time'" + + with pytest.raises(TypeError, match=msg): + df["date"] - df["time"] + + @pytest.fixture(params=product([True, False], [True, False])) def close_open_fixture(request): return request.param From 270dfeeaa917cf33097fe430fa8107083a8bab39 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 1 Feb 2020 15:46:59 +0200 Subject: [PATCH 02/19] Flake8 issues --- pandas/tests/frame/test_timeseries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_timeseries.py b/pandas/tests/frame/test_timeseries.py index 20a729f5cb4c1..bd0b1d7871df7 100644 --- a/pandas/tests/frame/test_timeseries.py +++ b/pandas/tests/frame/test_timeseries.py @@ -30,7 +30,7 @@ def test_no_idea_how_to_name_this_or_where_to_place_this(): } ) - msg = "unsupported operand type\(s\) for -: 'Timestamp' and 'datetime.time'" + msg = r"unsupported operand type\(s\) for -: 'Timestamp' and 'datetime.time'" with pytest.raises(TypeError, match=msg): df["date"] - df["time"] From 569106666114bd008a1920dbaf7f5ece4020001b Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <50263213+MomIsBestFriend@users.noreply.github.com> Date: Fri, 7 Feb 2020 13:12:24 +0200 Subject: [PATCH 03/19] Update pandas/tests/frame/test_timeseries.py Co-Authored-By: William Ayd --- pandas/tests/frame/test_timeseries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_timeseries.py b/pandas/tests/frame/test_timeseries.py index bd0b1d7871df7..602f6fcf64436 100644 --- a/pandas/tests/frame/test_timeseries.py +++ b/pandas/tests/frame/test_timeseries.py @@ -21,7 +21,7 @@ import pandas.tseries.offsets as offsets -def test_no_idea_how_to_name_this_or_where_to_place_this(): +def test_timestamp_and_time_dtype_raises(): # https://github.com/pandas-dev/pandas/issues/10329 df = pd.DataFrame( { From 2cf0756860d19ec75bf7caa58c6bfbe4dcd4f17f Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 7 Feb 2020 13:18:45 +0200 Subject: [PATCH 04/19] Moved the test case REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r373809447 --- pandas/tests/arithmetic/test_datetime64.py | 14 ++++++++++++++ pandas/tests/frame/test_timeseries.py | 15 --------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index d3f9ac4f3f8b2..c59eff1fcfdc9 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1056,6 +1056,20 @@ def test_dt64arr_add_sub_parr( ) assert_invalid_addsub_type(dtarr, parr, msg) + def test_timestamp_and_time_dtype_raises(): + # https://github.com/pandas-dev/pandas/issues/10329 + df = pd.DataFrame( + { + "date": pd.date_range("2012-01-01", periods=3), + "time": [time(i, i, i) for i in range(3)], + } + ) + + msg = r"unsupported operand type\(s\) for -: 'Timestamp' and 'datetime.time'" + + with pytest.raises(TypeError, match=msg): + df["date"] - df["time"] + class TestDatetime64DateOffsetArithmetic: diff --git a/pandas/tests/frame/test_timeseries.py b/pandas/tests/frame/test_timeseries.py index 602f6fcf64436..5e06b6402c34f 100644 --- a/pandas/tests/frame/test_timeseries.py +++ b/pandas/tests/frame/test_timeseries.py @@ -21,21 +21,6 @@ import pandas.tseries.offsets as offsets -def test_timestamp_and_time_dtype_raises(): - # https://github.com/pandas-dev/pandas/issues/10329 - df = pd.DataFrame( - { - "date": pd.date_range("2012-01-01", periods=3), - "time": [time(i, i, i) for i in range(3)], - } - ) - - msg = r"unsupported operand type\(s\) for -: 'Timestamp' and 'datetime.time'" - - with pytest.raises(TypeError, match=msg): - df["date"] - df["time"] - - @pytest.fixture(params=product([True, False], [True, False])) def close_open_fixture(request): return request.param From 33e24a3aee44ee4ca22b04ac7bddfee2bea149b0 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 14 Feb 2020 15:59:31 +0200 Subject: [PATCH 05/19] Refactored the test case to use 'box_with_array' --- pandas/tests/arithmetic/test_datetime64.py | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index c59eff1fcfdc9..b3ffffbe8097b 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1,7 +1,7 @@ # Arithmetic tests for DataFrame/Series/Index/Array classes that should # behave identically. # Specifically for datetime64 and datetime64tz dtypes -from datetime import datetime, timedelta +from datetime import datetime, timedelta, time from itertools import product, starmap import operator import warnings @@ -1056,19 +1056,21 @@ def test_dt64arr_add_sub_parr( ) assert_invalid_addsub_type(dtarr, parr, msg) - def test_timestamp_and_time_dtype_raises(): - # https://github.com/pandas-dev/pandas/issues/10329 - df = pd.DataFrame( - { - "date": pd.date_range("2012-01-01", periods=3), - "time": [time(i, i, i) for i in range(3)], - } - ) + def test_timestamp_and_time_dtype_raises(self, box_with_array): + # https://github.com/pandas-dev/pandas/issues/10329 + obj1 = pd.date_range("2012-01-01", periods=3) + obj2 = [time(i, i, i) for i in range(3)] + + obj1 = tm.box_expected(obj1, box_with_array) + obj2 = tm.box_expected(obj2, box_with_array) - msg = r"unsupported operand type\(s\) for -: 'Timestamp' and 'datetime.time'" + msg = ( + "unsupported operand type\(s\) for -: " + "'(Timestamp|DatetimeArray)' and 'datetime.time'" + ) - with pytest.raises(TypeError, match=msg): - df["date"] - df["time"] + with pytest.raises(TypeError, match=msg): + obj1 - obj2 class TestDatetime64DateOffsetArithmetic: From bc75e25fd1b66f9f2b8e466bf8ed6c5befeef15a Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 22 Feb 2020 12:30:56 +0200 Subject: [PATCH 06/19] Changed test name REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r381593594 --- pandas/tests/arithmetic/test_datetime64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index b3ffffbe8097b..298e65ef36857 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1056,7 +1056,7 @@ def test_dt64arr_add_sub_parr( ) assert_invalid_addsub_type(dtarr, parr, msg) - def test_timestamp_and_time_dtype_raises(self, box_with_array): + def test_timestamp_addsub_time_dtype_raises(self, box_with_array): # https://github.com/pandas-dev/pandas/issues/10329 obj1 = pd.date_range("2012-01-01", periods=3) obj2 = [time(i, i, i) for i in range(3)] From 94cedb90220145ab95b754635ab5f803b2d3846d Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 22 Feb 2020 12:34:00 +0200 Subject: [PATCH 07/19] Added the add operations REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r381593723 --- pandas/tests/arithmetic/test_datetime64.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 298e65ef36857..6c580a4fa82aa 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1065,12 +1065,18 @@ def test_timestamp_addsub_time_dtype_raises(self, box_with_array): obj2 = tm.box_expected(obj2, box_with_array) msg = ( - "unsupported operand type\(s\) for -: " + r"unsupported operand type\(s\) for -: " "'(Timestamp|DatetimeArray)' and 'datetime.time'" ) with pytest.raises(TypeError, match=msg): + # sub obj1 - obj2 + obj2 - obj1 + + # add + obj1 + obj2 + obj2 + obj1 class TestDatetime64DateOffsetArithmetic: From 1cafb6691151caa2ee2120c62334853aa0cd75a2 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 22 Feb 2020 12:39:56 +0200 Subject: [PATCH 08/19] Added time scalar to "other" REF: https://github.com/pandas-dev/pandas/pull/31538#issuecomment-588515307 --- pandas/tests/arithmetic/test_datetime64.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 6c580a4fa82aa..28c7abe315399 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1019,6 +1019,7 @@ def test_dt64arr_add_timestamp_raises(self, box_with_array): np.array([2.0, 3.0]), # GH#13078 datetime +/- Period is invalid pd.Period("2011-01-01", freq="D"), + time(1, 2, 3) ], ) @pytest.mark.parametrize("dti_freq", [None, "D"]) From a5608eb2b2d7c6293102c76974e7cf3b60f62f4d Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 22 Feb 2020 14:08:53 +0200 Subject: [PATCH 09/19] Lint --- pandas/tests/arithmetic/test_datetime64.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 28c7abe315399..019176a58e3b6 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1,7 +1,7 @@ # Arithmetic tests for DataFrame/Series/Index/Array classes that should # behave identically. # Specifically for datetime64 and datetime64tz dtypes -from datetime import datetime, timedelta, time +from datetime import datetime, time, timedelta from itertools import product, starmap import operator import warnings @@ -1019,7 +1019,7 @@ def test_dt64arr_add_timestamp_raises(self, box_with_array): np.array([2.0, 3.0]), # GH#13078 datetime +/- Period is invalid pd.Period("2011-01-01", freq="D"), - time(1, 2, 3) + time(1, 2, 3), ], ) @pytest.mark.parametrize("dti_freq", [None, "D"]) From fd04076cd3a12c58652ecdb4040b4c54a6435bb3 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 22 Feb 2020 14:24:51 +0200 Subject: [PATCH 10/19] Ignoring warnings, that we are not checking for this specific test case --- pandas/tests/arithmetic/test_datetime64.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 019176a58e3b6..e8345c292a077 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1071,13 +1071,18 @@ def test_timestamp_addsub_time_dtype_raises(self, box_with_array): ) with pytest.raises(TypeError, match=msg): - # sub - obj1 - obj2 - obj2 - obj1 - - # add - obj1 + obj2 - obj2 + obj1 + with warnings.catch_warnings(record=True): + # pandas.errors.PerformanceWarning: Non-vectorized DateOffset being + # applied to Series or DatetimeIndex + # we aren't testing that here, so ignore. + warnings.simplefilter("ignore", PerformanceWarning) + # sub + obj1 - obj2 + obj2 - obj1 + + # add + obj1 + obj2 + obj2 + obj1 class TestDatetime64DateOffsetArithmetic: From faf90e1d07e8ac458d7407daa707d49532083352 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Thu, 5 Mar 2020 12:36:02 +0200 Subject: [PATCH 11/19] Renamed test case REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r387428233 --- pandas/tests/arithmetic/test_datetime64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 1b340bdd9c2e5..13400cb586ef7 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1070,7 +1070,7 @@ def test_dt64arr_add_sub_parr( ) assert_invalid_addsub_type(dtarr, parr, msg) - def test_timestamp_addsub_time_dtype_raises(self, box_with_array): + def test_dt64arr_addsub_time_object_raises(self, box_with_array): # https://github.com/pandas-dev/pandas/issues/10329 obj1 = pd.date_range("2012-01-01", periods=3) obj2 = [time(i, i, i) for i in range(3)] From 5cdd1d12eb8b90996db5e3355cfe2ffdc4823d94 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Thu, 5 Mar 2020 12:43:01 +0200 Subject: [PATCH 12/19] Added comment pointing to the appropiate issue REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r387428573 --- pandas/tests/arithmetic/test_datetime64.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 13400cb586ef7..39fa94139c4b3 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1032,6 +1032,7 @@ def test_dt64arr_add_timestamp_raises(self, box_with_array): np.array([2.0, 3.0]), # GH#13078 datetime +/- Period is invalid pd.Period("2011-01-01", freq="D"), + # https://github.com/pandas-dev/pandas/issues/10329 time(1, 2, 3), ], ) From 6fef7f8f1b3d04bdb191a898ac1bc95313753cae Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Thu, 5 Mar 2020 12:48:37 +0200 Subject: [PATCH 13/19] Added tz_naive_fixture REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r387428265 --- pandas/tests/arithmetic/test_datetime64.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 39fa94139c4b3..b6551f63025a6 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1071,9 +1071,12 @@ def test_dt64arr_add_sub_parr( ) assert_invalid_addsub_type(dtarr, parr, msg) - def test_dt64arr_addsub_time_object_raises(self, box_with_array): + def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixture): # https://github.com/pandas-dev/pandas/issues/10329 - obj1 = pd.date_range("2012-01-01", periods=3) + + tz = tz_naive_fixture + + obj1 = pd.date_range("2012-01-01", periods=3, tz=tz) obj2 = [time(i, i, i) for i in range(3)] obj1 = tm.box_expected(obj1, box_with_array) From 799ae78858de08d7c90bae39892a8c91e4afe3b3 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 13 Mar 2020 12:29:23 +0200 Subject: [PATCH 14/19] Putting each expression in its own `pytest.raises` REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r390714698 --- pandas/tests/arithmetic/test_datetime64.py | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index b6551f63025a6..d8bc406e875c5 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1082,23 +1082,32 @@ def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixtur obj1 = tm.box_expected(obj1, box_with_array) obj2 = tm.box_expected(obj2, box_with_array) - msg = ( - r"unsupported operand type\(s\) for -: " - "'(Timestamp|DatetimeArray)' and 'datetime.time'" - ) + with warnings.catch_warnings(record=True): + # pandas.errors.PerformanceWarning: Non-vectorized DateOffset being + # applied to Series or DatetimeIndex + # we aren't testing that here, so ignore. + warnings.simplefilter("ignore", PerformanceWarning) - with pytest.raises(TypeError, match=msg): - with warnings.catch_warnings(record=True): - # pandas.errors.PerformanceWarning: Non-vectorized DateOffset being - # applied to Series or DatetimeIndex - # we aren't testing that here, so ignore. - warnings.simplefilter("ignore", PerformanceWarning) + # If `x + y` raises, then `y + x` should raise here as well + + msg = ( + r"unsupported operand type\(s\) for -: " + "'(Timestamp|DatetimeArray)' and 'datetime.time'", + ) + with pytest.raises(TypeError, match=msg): # sub obj1 - obj2 + + with pytest.raises(TypeError, match=msg): + # sub obj2 - obj1 + with pytest.raises(TypeError, match=msg): # add obj1 + obj2 + + with pytest.raises(TypeError, match=msg): + # add obj2 + obj1 From 54ea5a0048c6edbc6f6bf13c04c5c67b238de790 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 13 Mar 2020 12:42:20 +0200 Subject: [PATCH 15/19] Fixed tests to pass --- pandas/tests/arithmetic/test_datetime64.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index d8bc406e875c5..772cc66bb74ad 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1092,20 +1092,39 @@ def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixtur msg = ( r"unsupported operand type\(s\) for -: " - "'(Timestamp|DatetimeArray)' and 'datetime.time'", + "'(Timestamp|DatetimeArray)' and 'datetime.time'" ) with pytest.raises(TypeError, match=msg): # sub obj1 - obj2 + msg = "|".join( + [ + "cannot subtract DatetimeArray from ndarray", + "ufunc 'subtract' cannot use operands with types " + r"dtype\('O'\) and dtype\(' Date: Fri, 13 Mar 2020 20:34:52 +0200 Subject: [PATCH 16/19] Removed unneeded comments REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r392399930 --- pandas/tests/arithmetic/test_datetime64.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 772cc66bb74ad..5ce230156613c 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1095,7 +1095,6 @@ def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixtur "'(Timestamp|DatetimeArray)' and 'datetime.time'" ) with pytest.raises(TypeError, match=msg): - # sub obj1 - obj2 msg = "|".join( @@ -1106,7 +1105,6 @@ def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixtur ] ) with pytest.raises(TypeError, match=msg): - # sub obj2 - obj1 msg = ( @@ -1114,7 +1112,6 @@ def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixtur "'(Timestamp|DatetimeArray)' and 'datetime.time'" ) with pytest.raises(TypeError, match=msg): - # add obj1 + obj2 msg = "|".join( @@ -1126,7 +1123,6 @@ def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixtur ] ) with pytest.raises(TypeError, match=msg): - # add obj2 + obj1 From 1449d8c1b48e8a146d35461a0f2e5891cb8dd7df Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Wed, 18 Mar 2020 22:04:22 +0200 Subject: [PATCH 17/19] Renamed test case REF: https://github.com/pandas-dev/pandas/pull/31538#discussion_r394592477 --- pandas/tests/arithmetic/test_datetime64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 5ce230156613c..8a21043142b94 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1071,7 +1071,7 @@ def test_dt64arr_add_sub_parr( ) assert_invalid_addsub_type(dtarr, parr, msg) - def test_dt64arr_addsub_time_object_raises(self, box_with_array, tz_naive_fixture): + def test_dt64arr_addsub_time_objects_raises(self, box_with_array, tz_naive_fixture): # https://github.com/pandas-dev/pandas/issues/10329 tz = tz_naive_fixture From 5954709891ea7fbae0368132108876b7c40b6265 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sun, 29 Mar 2020 15:42:54 +0300 Subject: [PATCH 18/19] Fixed error message --- pandas/tests/arithmetic/test_datetime64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 8a21043142b94..1cd10e4fbc3b2 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1100,7 +1100,7 @@ def test_dt64arr_addsub_time_objects_raises(self, box_with_array, tz_naive_fixtu msg = "|".join( [ "cannot subtract DatetimeArray from ndarray", - "ufunc 'subtract' cannot use operands with types " + "ufunc (subtract|'subtract') cannot use operands with types " r"dtype\('O'\) and dtype\(' Date: Sun, 29 Mar 2020 16:00:21 +0300 Subject: [PATCH 19/19] Fixed error message --- pandas/tests/arithmetic/test_datetime64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 1cd10e4fbc3b2..9a6ae76658949 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -1118,7 +1118,7 @@ def test_dt64arr_addsub_time_objects_raises(self, box_with_array, tz_naive_fixtu [ r"unsupported operand type\(s\) for \+: " "'(Timestamp|DatetimeArray)' and 'datetime.time'", - "ufunc 'add' cannot use operands with types " + "ufunc (add|'add') cannot use operands with types " r"dtype\('O'\) and dtype\('