59
59
60
60
from pandas .core .arrays .arrow .dtype import ArrowDtype # isort:skip
61
61
62
- pytestmark = pytest .mark .filterwarnings (
63
- "ignore:.* may decrease performance. Upgrade to pyarrow >=7 to possibly"
64
- )
65
-
66
62
67
63
@pytest .fixture (params = tm .ALL_PYARROW_DTYPES , ids = str )
68
64
def dtype (request ):
@@ -311,14 +307,7 @@ def test_from_sequence_of_strings_pa_array(self, data, request):
311
307
)
312
308
)
313
309
elif pa .types .is_timestamp (pa_dtype ) and pa_dtype .tz is not None :
314
- if pa_version_under7p0 :
315
- request .node .add_marker (
316
- pytest .mark .xfail (
317
- raises = pa .ArrowNotImplementedError ,
318
- reason = f"pyarrow doesn't support string cast from { pa_dtype } " ,
319
- )
320
- )
321
- elif is_platform_windows () and is_ci_environment ():
310
+ if is_platform_windows () and is_ci_environment ():
322
311
request .node .add_marker (
323
312
pytest .mark .xfail (
324
313
raises = pa .ArrowInvalid ,
@@ -561,23 +550,7 @@ def test_groupby_extension_transform(self, data_for_grouping, request):
561
550
reason = f"{ pa_dtype } only has 2 unique possible values" ,
562
551
)
563
552
)
564
- with tm .maybe_produces_warning (
565
- PerformanceWarning ,
566
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
567
- check_stacklevel = False ,
568
- ):
569
- super ().test_groupby_extension_transform (data_for_grouping )
570
-
571
- def test_groupby_extension_apply (
572
- self , data_for_grouping , groupby_apply_op , request
573
- ):
574
- pa_dtype = data_for_grouping .dtype .pyarrow_dtype
575
- with tm .maybe_produces_warning (
576
- PerformanceWarning ,
577
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
578
- check_stacklevel = False ,
579
- ):
580
- super ().test_groupby_extension_apply (data_for_grouping , groupby_apply_op )
553
+ super ().test_groupby_extension_transform (data_for_grouping )
581
554
582
555
@pytest .mark .parametrize ("as_index" , [True , False ])
583
556
def test_groupby_extension_agg (self , as_index , data_for_grouping , request ):
@@ -589,12 +562,7 @@ def test_groupby_extension_agg(self, as_index, data_for_grouping, request):
589
562
reason = f"{ pa_dtype } only has 2 unique possible values" ,
590
563
)
591
564
)
592
- with tm .maybe_produces_warning (
593
- PerformanceWarning ,
594
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
595
- check_stacklevel = False ,
596
- ):
597
- super ().test_groupby_extension_agg (as_index , data_for_grouping )
565
+ super ().test_groupby_extension_agg (as_index , data_for_grouping )
598
566
599
567
def test_in_numeric_groupby (self , data_for_grouping ):
600
568
if is_string_dtype (data_for_grouping .dtype ):
@@ -712,14 +680,20 @@ def test_view(self, data):
712
680
713
681
class TestBaseMissing (base .BaseMissingTests ):
714
682
def test_fillna_no_op_returns_copy (self , data ):
715
- with tm .maybe_produces_warning (
716
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
717
- ):
718
- super ().test_fillna_no_op_returns_copy (data )
683
+ data = data [~ data .isna ()]
684
+
685
+ valid = data [0 ]
686
+ result = data .fillna (valid )
687
+ assert result is not data
688
+ self .assert_extension_array_equal (result , data )
689
+ with tm .assert_produces_warning (PerformanceWarning ):
690
+ result = data .fillna (method = "backfill" )
691
+ assert result is not data
692
+ self .assert_extension_array_equal (result , data )
719
693
720
694
def test_fillna_series_method (self , data_missing , fillna_method ):
721
695
with tm .maybe_produces_warning (
722
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
696
+ PerformanceWarning , fillna_method is not None , check_stacklevel = False
723
697
):
724
698
super ().test_fillna_series_method (data_missing , fillna_method )
725
699
@@ -797,12 +771,6 @@ def test_invert(self, data, request):
797
771
798
772
799
773
class TestBaseMethods (base .BaseMethodsTests ):
800
- def test_argsort_missing_array (self , data_missing_for_sorting ):
801
- with tm .maybe_produces_warning (
802
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
803
- ):
804
- super ().test_argsort_missing_array (data_missing_for_sorting )
805
-
806
774
@pytest .mark .parametrize ("periods" , [1 , - 2 ])
807
775
def test_diff (self , data , periods , request ):
808
776
pa_dtype = data .dtype .pyarrow_dtype
@@ -817,20 +785,10 @@ def test_diff(self, data, periods, request):
817
785
)
818
786
super ().test_diff (data , periods )
819
787
820
- @pytest .mark .filterwarnings ("ignore:Falling back:pandas.errors.PerformanceWarning" )
821
788
@pytest .mark .parametrize ("dropna" , [True , False ])
822
789
def test_value_counts (self , all_data , dropna , request ):
823
790
super ().test_value_counts (all_data , dropna )
824
791
825
- def test_value_counts_with_normalize (self , data , request ):
826
- pa_dtype = data .dtype .pyarrow_dtype
827
- with tm .maybe_produces_warning (
828
- PerformanceWarning ,
829
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
830
- check_stacklevel = False ,
831
- ):
832
- super ().test_value_counts_with_normalize (data )
833
-
834
792
def test_argmin_argmax (
835
793
self , data_for_sorting , data_missing_for_sorting , na_value , request
836
794
):
@@ -878,47 +836,6 @@ def test_argreduce_series(
878
836
data_missing_for_sorting , op_name , skipna , expected
879
837
)
880
838
881
- @pytest .mark .parametrize (
882
- "na_position, expected" ,
883
- [
884
- ("last" , np .array ([2 , 0 , 1 ], dtype = np .dtype ("intp" ))),
885
- ("first" , np .array ([1 , 2 , 0 ], dtype = np .dtype ("intp" ))),
886
- ],
887
- )
888
- def test_nargsort (self , data_missing_for_sorting , na_position , expected ):
889
- with tm .maybe_produces_warning (
890
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
891
- ):
892
- super ().test_nargsort (data_missing_for_sorting , na_position , expected )
893
-
894
- @pytest .mark .parametrize ("ascending" , [True , False ])
895
- def test_sort_values (self , data_for_sorting , ascending , sort_by_key , request ):
896
- with tm .maybe_produces_warning (
897
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
898
- ):
899
- super ().test_sort_values (data_for_sorting , ascending , sort_by_key )
900
-
901
- @pytest .mark .parametrize ("ascending" , [True , False ])
902
- def test_sort_values_missing (
903
- self , data_missing_for_sorting , ascending , sort_by_key
904
- ):
905
- with tm .maybe_produces_warning (
906
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
907
- ):
908
- super ().test_sort_values_missing (
909
- data_missing_for_sorting , ascending , sort_by_key
910
- )
911
-
912
- @pytest .mark .parametrize ("ascending" , [True , False ])
913
- def test_sort_values_frame (self , data_for_sorting , ascending , request ):
914
- pa_dtype = data_for_sorting .dtype .pyarrow_dtype
915
- with tm .maybe_produces_warning (
916
- PerformanceWarning ,
917
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
918
- check_stacklevel = False ,
919
- ):
920
- super ().test_sort_values_frame (data_for_sorting , ascending )
921
-
922
839
def test_factorize (self , data_for_grouping , request ):
923
840
pa_dtype = data_for_grouping .dtype .pyarrow_dtype
924
841
if pa .types .is_boolean (pa_dtype ):
0 commit comments