@@ -3246,60 +3246,71 @@ def test_arrow_floordiv_large_values():
3246
3246
tm .assert_series_equal (result , expected )
3247
3247
3248
3248
3249
- def test_arrow_floordiv_large_integral_result ():
3249
+ @pytest .mark .parametrize ("dtype" , ["int64[pyarrow]" , "uint64[pyarrow]" ])
3250
+ def test_arrow_floordiv_large_integral_result (dtype ):
3250
3251
# GH 56676
3251
- a = pd .Series ([18014398509481983 , - 9223372036854775808 ], dtype = "int64[pyarrow]" )
3252
+ a = pd .Series ([18014398509481983 ], dtype = dtype )
3252
3253
result = a // 1
3253
3254
tm .assert_series_equal (result , a )
3254
3255
3255
3256
3256
- def test_arrow_floordiv_larger_divisor ():
3257
+ @pytest .mark .parametrize ("pa_type" , tm .SIGNED_INT_PYARROW_DTYPES )
3258
+ def test_arrow_floordiv_larger_divisor (pa_type ):
3257
3259
# GH 56676
3258
- a = pd .Series ([- 23 ], dtype = "int64[pyarrow]" )
3260
+ dtype = ArrowDtype (pa_type )
3261
+ a = pd .Series ([- 23 ], dtype = dtype )
3259
3262
result = a // 24
3260
- expected = pd .Series ([- 1 ], dtype = "int64[pyarrow]" )
3263
+ expected = pd .Series ([- 1 ], dtype = dtype )
3261
3264
tm .assert_series_equal (result , expected )
3262
3265
3263
3266
3264
- def test_arrow_floordiv_integral_invalid ():
3267
+ @pytest .mark .parametrize ("pa_type" , tm .SIGNED_INT_PYARROW_DTYPES )
3268
+ def test_arrow_floordiv_integral_invalid (pa_type ):
3265
3269
# GH 56676
3266
- a = pd .Series ([- 9223372036854775808 ], dtype = "int64[pyarrow]" )
3267
- with pytest .raises (pa .lib .ArrowInvalid , match = "overflow" ):
3270
+ min_value = np .iinfo (pa_type .to_pandas_dtype ()).min
3271
+ a = pd .Series ([min_value ], dtype = ArrowDtype (pa_type ))
3272
+ with pytest .raises (pa .lib .ArrowInvalid , match = "overflow|not in range" ):
3268
3273
a // - 1
3269
3274
with pytest .raises (pa .lib .ArrowInvalid , match = "divide by zero" ):
3270
3275
a // 0
3271
3276
3272
3277
3273
- def test_arrow_floordiv_floating_0_divisor ():
3278
+ @pytest .mark .parametrize ("dtype" , tm .FLOAT_PYARROW_DTYPES_STR_REPR )
3279
+ def test_arrow_floordiv_floating_0_divisor (dtype ):
3274
3280
# GH 56676
3275
- a = pd .Series ([2 ], dtype = "double[pyarrow]" )
3281
+ a = pd .Series ([2 ], dtype = dtype )
3276
3282
result = a // 0
3277
- expected = pd .Series ([float ("inf" )], dtype = "double[pyarrow]" )
3283
+ expected = pd .Series ([float ("inf" )], dtype = dtype )
3278
3284
tm .assert_series_equal (result , expected )
3279
3285
3280
3286
3281
- def test_arrow_floordiv_no_overflow ():
3287
+ @pytest .mark .parametrize ("pa_type" , tm .ALL_INT_PYARROW_DTYPES )
3288
+ def test_arrow_integral_floordiv_large_values (pa_type ):
3282
3289
# GH 56676
3283
- a = pd .Series ([9223372036854775808 ], dtype = "uint64[pyarrow]" )
3284
- b = pd .Series ([1 ], dtype = "uint64[pyarrow]" )
3290
+ max_value = np .iinfo (pa_type .to_pandas_dtype ()).max
3291
+ dtype = ArrowDtype (pa_type )
3292
+ a = pd .Series ([max_value ], dtype = dtype )
3293
+ b = pd .Series ([1 ], dtype = dtype )
3285
3294
result = a // b
3286
3295
tm .assert_series_equal (result , a )
3287
3296
3288
3297
3289
- def test_arrow_true_division_large_divisor ():
3298
+ @pytest .mark .parametrize ("dtype" , ["int64[pyarrow]" , "uint64[pyarrow]" ])
3299
+ def test_arrow_true_division_large_divisor (dtype ):
3290
3300
# GH 56706
3291
- a = pd .Series ([0 ], dtype = "int64[pyarrow]" )
3292
- b = pd .Series ([18014398509481983 ], dtype = "int64[pyarrow]" )
3301
+ a = pd .Series ([0 ], dtype = dtype )
3302
+ b = pd .Series ([18014398509481983 ], dtype = dtype )
3293
3303
expected = pd .Series ([0 ], dtype = "float64[pyarrow]" )
3294
3304
result = a / b
3295
3305
tm .assert_series_equal (result , expected )
3296
3306
3297
3307
3298
- def test_arrow_floor_division_large_divisor ():
3308
+ @pytest .mark .parametrize ("dtype" , ["int64[pyarrow]" , "uint64[pyarrow]" ])
3309
+ def test_arrow_floor_division_large_divisor (dtype ):
3299
3310
# GH 56706
3300
- a = pd .Series ([0 ], dtype = "int64[pyarrow]" )
3301
- b = pd .Series ([18014398509481983 ], dtype = "int64[pyarrow]" )
3302
- expected = pd .Series ([0 ], dtype = "int64[pyarrow]" )
3311
+ a = pd .Series ([0 ], dtype = dtype )
3312
+ b = pd .Series ([18014398509481983 ], dtype = dtype )
3313
+ expected = pd .Series ([0 ], dtype = dtype )
3303
3314
result = a // b
3304
3315
tm .assert_series_equal (result , expected )
3305
3316
0 commit comments