@@ -89,8 +89,9 @@ def test_compare_invalid(self):
8989 b .name = pd .Timestamp ("2000-01-01" )
9090 tm .assert_series_equal (a / b , 1 / (b / a ))
9191
92- def test_numeric_cmp_string_numexpr_path (self , box ):
92+ def test_numeric_cmp_string_numexpr_path (self , box_with_array ):
9393 # GH#36377, GH#35700
94+ box = box_with_array
9495 xbox = box if box is not pd .Index else np .ndarray
9596
9697 obj = pd .Series (np .random .randn (10 ** 5 ))
@@ -183,10 +184,14 @@ def test_ops_series(self):
183184 ],
184185 ids = lambda x : type (x ).__name__ ,
185186 )
186- def test_numeric_arr_mul_tdscalar (self , scalar_td , numeric_idx , box ):
187+ def test_numeric_arr_mul_tdscalar (self , scalar_td , numeric_idx , box_with_array ):
187188 # GH#19333
189+ box = box_with_array
190+ if box is pd .array :
191+ pytest .xfail (
192+ "we get a PandasArray[timedelta64[ns]] instead of TimedeltaArray"
193+ )
188194 index = numeric_idx
189-
190195 expected = pd .TimedeltaIndex ([pd .Timedelta (days = n ) for n in range (5 )])
191196
192197 index = tm .box_expected (index , box )
@@ -207,7 +212,11 @@ def test_numeric_arr_mul_tdscalar(self, scalar_td, numeric_idx, box):
207212 ],
208213 ids = lambda x : type (x ).__name__ ,
209214 )
210- def test_numeric_arr_mul_tdscalar_numexpr_path (self , scalar_td , box ):
215+ def test_numeric_arr_mul_tdscalar_numexpr_path (self , scalar_td , box_with_array ):
216+ box = box_with_array
217+ if box is pd .array :
218+ pytest .xfail ("IntegerArray.__mul__ doesnt handle timedeltas" )
219+
211220 arr = np .arange (2 * 10 ** 4 ).astype (np .int64 )
212221 obj = tm .box_expected (arr , box , transpose = False )
213222
@@ -220,7 +229,11 @@ def test_numeric_arr_mul_tdscalar_numexpr_path(self, scalar_td, box):
220229 result = scalar_td * obj
221230 tm .assert_equal (result , expected )
222231
223- def test_numeric_arr_rdiv_tdscalar (self , three_days , numeric_idx , box ):
232+ def test_numeric_arr_rdiv_tdscalar (self , three_days , numeric_idx , box_with_array ):
233+ box = box_with_array
234+ if box is pd .array :
235+ pytest .xfail ("We get PandasArray[td64] instead of TimedeltaArray" )
236+
224237 index = numeric_idx [1 :3 ]
225238
226239 expected = TimedeltaIndex (["3 Days" , "36 Hours" ])
@@ -248,7 +261,11 @@ def test_numeric_arr_rdiv_tdscalar(self, three_days, numeric_idx, box):
248261 pd .offsets .Second (0 ),
249262 ],
250263 )
251- def test_add_sub_timedeltalike_invalid (self , numeric_idx , other , box ):
264+ def test_add_sub_timedeltalike_invalid (self , numeric_idx , other , box_with_array ):
265+ box = box_with_array
266+ if box is pd .array :
267+ pytest .xfail ("PandasArray[int].__add__ doesnt raise on td64" )
268+
252269 left = tm .box_expected (numeric_idx , box )
253270 msg = (
254271 "unsupported operand type|"
@@ -276,16 +293,21 @@ def test_add_sub_timedeltalike_invalid(self, numeric_idx, other, box):
276293 ],
277294 )
278295 @pytest .mark .filterwarnings ("ignore:elementwise comp:DeprecationWarning" )
279- def test_add_sub_datetimelike_invalid (self , numeric_idx , other , box ):
296+ def test_add_sub_datetimelike_invalid (self , numeric_idx , other , box_with_array ):
280297 # GH#28080 numeric+datetime64 should raise; Timestamp raises
281298 # NullFrequencyError instead of TypeError so is excluded.
299+ box = box_with_array
282300 left = tm .box_expected (numeric_idx , box )
283301
284- msg = (
285- "unsupported operand type|"
286- "Cannot (add|subtract) NaT (to|from) ndarray|"
287- "Addition/subtraction of integers and integer-arrays|"
288- "Concatenation operation is not implemented for NumPy arrays"
302+ msg = "|" .join (
303+ [
304+ "unsupported operand type" ,
305+ "Cannot (add|subtract) NaT (to|from) ndarray" ,
306+ "Addition/subtraction of integers and integer-arrays" ,
307+ "Concatenation operation is not implemented for NumPy arrays" ,
308+ # pd.array vs np.datetime64 case
309+ r"operand type\(s\) all returned NotImplemented from __array_ufunc__" ,
310+ ]
289311 )
290312 with pytest .raises (TypeError , match = msg ):
291313 left + other
@@ -568,8 +590,9 @@ class TestMultiplicationDivision:
568590 # __mul__, __rmul__, __div__, __rdiv__, __floordiv__, __rfloordiv__
569591 # for non-timestamp/timedelta/period dtypes
570592
571- def test_divide_decimal (self , box ):
593+ def test_divide_decimal (self , box_with_array ):
572594 # resolves issue GH#9787
595+ box = box_with_array
573596 ser = Series ([Decimal (10 )])
574597 expected = Series ([Decimal (5 )])
575598
0 commit comments