25
25
pa_version_under3p0 ,
26
26
pa_version_under4p0 ,
27
27
pa_version_under6p0 ,
28
+ pa_version_under7p0 ,
28
29
pa_version_under8p0 ,
29
30
pa_version_under9p0 ,
30
31
)
32
+ from pandas .errors import PerformanceWarning
31
33
32
34
import pandas as pd
33
35
import pandas ._testing as tm
@@ -446,7 +448,10 @@ def test_groupby_extension_transform(self, data_for_grouping, request):
446
448
reason = f"pyarrow doesn't support factorizing { pa_dtype } " ,
447
449
)
448
450
)
449
- super ().test_groupby_extension_transform (data_for_grouping )
451
+ with tm .maybe_produces_warning (
452
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
453
+ ):
454
+ super ().test_groupby_extension_transform (data_for_grouping )
450
455
451
456
def test_groupby_extension_apply (
452
457
self , data_for_grouping , groupby_apply_op , request
@@ -479,7 +484,10 @@ def test_groupby_extension_apply(
479
484
reason = "GH 34986" ,
480
485
)
481
486
)
482
- super ().test_groupby_extension_apply (data_for_grouping , groupby_apply_op )
487
+ with tm .maybe_produces_warning (
488
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
489
+ ):
490
+ super ().test_groupby_extension_apply (data_for_grouping , groupby_apply_op )
483
491
484
492
def test_in_numeric_groupby (self , data_for_grouping , request ):
485
493
pa_dtype = data_for_grouping .dtype .pyarrow_dtype
@@ -518,7 +526,10 @@ def test_groupby_extension_agg(self, as_index, data_for_grouping, request):
518
526
reason = "GH 34986" ,
519
527
)
520
528
)
521
- super ().test_groupby_extension_agg (as_index , data_for_grouping )
529
+ with tm .maybe_produces_warning (
530
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
531
+ ):
532
+ super ().test_groupby_extension_agg (as_index , data_for_grouping )
522
533
523
534
524
535
class TestBaseDtype (base .BaseDtypeTests ):
@@ -607,6 +618,10 @@ def test_view(self, data):
607
618
608
619
609
620
class TestBaseMissing (base .BaseMissingTests ):
621
+ @pytest .mark .filterwarnings ("ignore:Falling back:pandas.errors.PerformanceWarning" )
622
+ def test_dropna_array (self , data_missing ):
623
+ super ().test_dropna_array (data_missing )
624
+
610
625
def test_fillna_limit_pad (self , data_missing , using_array_manager , request ):
611
626
if using_array_manager and pa .types .is_duration (
612
627
data_missing .dtype .pyarrow_dtype
@@ -1331,6 +1346,12 @@ def test_invert(self, data, request):
1331
1346
1332
1347
1333
1348
class TestBaseMethods (base .BaseMethodsTests ):
1349
+ def test_argsort_missing_array (self , data_missing_for_sorting ):
1350
+ with tm .maybe_produces_warning (
1351
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
1352
+ ):
1353
+ super ().test_argsort_missing_array (data_missing_for_sorting )
1354
+
1334
1355
@pytest .mark .parametrize ("periods" , [1 , - 2 ])
1335
1356
def test_diff (self , data , periods , request ):
1336
1357
pa_dtype = data .dtype .pyarrow_dtype
@@ -1345,6 +1366,7 @@ def test_diff(self, data, periods, request):
1345
1366
)
1346
1367
super ().test_diff (data , periods )
1347
1368
1369
+ @pytest .mark .filterwarnings ("ignore:Falling back:pandas.errors.PerformanceWarning" )
1348
1370
@pytest .mark .parametrize ("dropna" , [True , False ])
1349
1371
def test_value_counts (self , all_data , dropna , request ):
1350
1372
pa_dtype = all_data .dtype .pyarrow_dtype
@@ -1384,7 +1406,10 @@ def test_value_counts_with_normalize(self, data, request):
1384
1406
reason = f"value_count has no pyarrow kernel for { pa_dtype } " ,
1385
1407
)
1386
1408
)
1387
- super ().test_value_counts_with_normalize (data )
1409
+ with tm .maybe_produces_warning (
1410
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
1411
+ ):
1412
+ super ().test_value_counts_with_normalize (data )
1388
1413
1389
1414
@pytest .mark .xfail (
1390
1415
pa_version_under6p0 ,
@@ -1445,6 +1470,19 @@ def test_argreduce_series(
1445
1470
data_missing_for_sorting , op_name , skipna , expected
1446
1471
)
1447
1472
1473
+ @pytest .mark .parametrize (
1474
+ "na_position, expected" ,
1475
+ [
1476
+ ("last" , np .array ([2 , 0 , 1 ], dtype = np .dtype ("intp" ))),
1477
+ ("first" , np .array ([1 , 2 , 0 ], dtype = np .dtype ("intp" ))),
1478
+ ],
1479
+ )
1480
+ def test_nargsort (self , data_missing_for_sorting , na_position , expected ):
1481
+ with tm .maybe_produces_warning (
1482
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
1483
+ ):
1484
+ super ().test_nargsort (data_missing_for_sorting , na_position , expected )
1485
+
1448
1486
@pytest .mark .parametrize ("ascending" , [True , False ])
1449
1487
def test_sort_values (self , data_for_sorting , ascending , sort_by_key , request ):
1450
1488
pa_dtype = data_for_sorting .dtype .pyarrow_dtype
@@ -1458,7 +1496,21 @@ def test_sort_values(self, data_for_sorting, ascending, sort_by_key, request):
1458
1496
),
1459
1497
)
1460
1498
)
1461
- super ().test_sort_values (data_for_sorting , ascending , sort_by_key )
1499
+ with tm .maybe_produces_warning (
1500
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
1501
+ ):
1502
+ super ().test_sort_values (data_for_sorting , ascending , sort_by_key )
1503
+
1504
+ @pytest .mark .parametrize ("ascending" , [True , False ])
1505
+ def test_sort_values_missing (
1506
+ self , data_missing_for_sorting , ascending , sort_by_key
1507
+ ):
1508
+ with tm .maybe_produces_warning (
1509
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
1510
+ ):
1511
+ super ().test_sort_values_missing (
1512
+ data_missing_for_sorting , ascending , sort_by_key
1513
+ )
1462
1514
1463
1515
@pytest .mark .parametrize ("ascending" , [True , False ])
1464
1516
def test_sort_values_frame (self , data_for_sorting , ascending , request ):
@@ -1473,7 +1525,10 @@ def test_sort_values_frame(self, data_for_sorting, ascending, request):
1473
1525
),
1474
1526
)
1475
1527
)
1476
- super ().test_sort_values_frame (data_for_sorting , ascending )
1528
+ with tm .maybe_produces_warning (
1529
+ PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
1530
+ ):
1531
+ super ().test_sort_values_frame (data_for_sorting , ascending )
1477
1532
1478
1533
@pytest .mark .parametrize ("box" , [pd .Series , lambda x : x ])
1479
1534
@pytest .mark .parametrize ("method" , [lambda x : x .unique (), pd .unique ])
0 commit comments