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 ,
@@ -569,23 +558,7 @@ def test_groupby_extension_transform(self, data_for_grouping, request):
569
558
reason = f"{ pa_dtype } only has 2 unique possible values" ,
570
559
)
571
560
)
572
- with tm .maybe_produces_warning (
573
- PerformanceWarning ,
574
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
575
- check_stacklevel = False ,
576
- ):
577
- super ().test_groupby_extension_transform (data_for_grouping )
578
-
579
- def test_groupby_extension_apply (
580
- self , data_for_grouping , groupby_apply_op , request
581
- ):
582
- pa_dtype = data_for_grouping .dtype .pyarrow_dtype
583
- with tm .maybe_produces_warning (
584
- PerformanceWarning ,
585
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
586
- check_stacklevel = False ,
587
- ):
588
- super ().test_groupby_extension_apply (data_for_grouping , groupby_apply_op )
561
+ super ().test_groupby_extension_transform (data_for_grouping )
589
562
590
563
@pytest .mark .parametrize ("as_index" , [True , False ])
591
564
def test_groupby_extension_agg (self , as_index , data_for_grouping , request ):
@@ -597,12 +570,7 @@ def test_groupby_extension_agg(self, as_index, data_for_grouping, request):
597
570
reason = f"{ pa_dtype } only has 2 unique possible values" ,
598
571
)
599
572
)
600
- with tm .maybe_produces_warning (
601
- PerformanceWarning ,
602
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
603
- check_stacklevel = False ,
604
- ):
605
- super ().test_groupby_extension_agg (as_index , data_for_grouping )
573
+ super ().test_groupby_extension_agg (as_index , data_for_grouping )
606
574
607
575
def test_in_numeric_groupby (self , data_for_grouping ):
608
576
if is_string_dtype (data_for_grouping .dtype ):
@@ -720,14 +688,20 @@ def test_view(self, data):
720
688
721
689
class TestBaseMissing (base .BaseMissingTests ):
722
690
def test_fillna_no_op_returns_copy (self , data ):
723
- with tm .maybe_produces_warning (
724
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
725
- ):
726
- super ().test_fillna_no_op_returns_copy (data )
691
+ data = data [~ data .isna ()]
692
+
693
+ valid = data [0 ]
694
+ result = data .fillna (valid )
695
+ assert result is not data
696
+ self .assert_extension_array_equal (result , data )
697
+ with tm .assert_produces_warning (PerformanceWarning ):
698
+ result = data .fillna (method = "backfill" )
699
+ assert result is not data
700
+ self .assert_extension_array_equal (result , data )
727
701
728
702
def test_fillna_series_method (self , data_missing , fillna_method ):
729
703
with tm .maybe_produces_warning (
730
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
704
+ PerformanceWarning , fillna_method is not None , check_stacklevel = False
731
705
):
732
706
super ().test_fillna_series_method (data_missing , fillna_method )
733
707
@@ -805,12 +779,6 @@ def test_invert(self, data, request):
805
779
806
780
807
781
class TestBaseMethods (base .BaseMethodsTests ):
808
- def test_argsort_missing_array (self , data_missing_for_sorting ):
809
- with tm .maybe_produces_warning (
810
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
811
- ):
812
- super ().test_argsort_missing_array (data_missing_for_sorting )
813
-
814
782
@pytest .mark .parametrize ("periods" , [1 , - 2 ])
815
783
def test_diff (self , data , periods , request ):
816
784
pa_dtype = data .dtype .pyarrow_dtype
@@ -825,20 +793,10 @@ def test_diff(self, data, periods, request):
825
793
)
826
794
super ().test_diff (data , periods )
827
795
828
- @pytest .mark .filterwarnings ("ignore:Falling back:pandas.errors.PerformanceWarning" )
829
796
@pytest .mark .parametrize ("dropna" , [True , False ])
830
797
def test_value_counts (self , all_data , dropna , request ):
831
798
super ().test_value_counts (all_data , dropna )
832
799
833
- def test_value_counts_with_normalize (self , data , request ):
834
- pa_dtype = data .dtype .pyarrow_dtype
835
- with tm .maybe_produces_warning (
836
- PerformanceWarning ,
837
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
838
- check_stacklevel = False ,
839
- ):
840
- super ().test_value_counts_with_normalize (data )
841
-
842
800
def test_argmin_argmax (
843
801
self , data_for_sorting , data_missing_for_sorting , na_value , request
844
802
):
@@ -886,47 +844,6 @@ def test_argreduce_series(
886
844
data_missing_for_sorting , op_name , skipna , expected
887
845
)
888
846
889
- @pytest .mark .parametrize (
890
- "na_position, expected" ,
891
- [
892
- ("last" , np .array ([2 , 0 , 1 ], dtype = np .dtype ("intp" ))),
893
- ("first" , np .array ([1 , 2 , 0 ], dtype = np .dtype ("intp" ))),
894
- ],
895
- )
896
- def test_nargsort (self , data_missing_for_sorting , na_position , expected ):
897
- with tm .maybe_produces_warning (
898
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
899
- ):
900
- super ().test_nargsort (data_missing_for_sorting , na_position , expected )
901
-
902
- @pytest .mark .parametrize ("ascending" , [True , False ])
903
- def test_sort_values (self , data_for_sorting , ascending , sort_by_key , request ):
904
- with tm .maybe_produces_warning (
905
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
906
- ):
907
- super ().test_sort_values (data_for_sorting , ascending , sort_by_key )
908
-
909
- @pytest .mark .parametrize ("ascending" , [True , False ])
910
- def test_sort_values_missing (
911
- self , data_missing_for_sorting , ascending , sort_by_key
912
- ):
913
- with tm .maybe_produces_warning (
914
- PerformanceWarning , pa_version_under7p0 , check_stacklevel = False
915
- ):
916
- super ().test_sort_values_missing (
917
- data_missing_for_sorting , ascending , sort_by_key
918
- )
919
-
920
- @pytest .mark .parametrize ("ascending" , [True , False ])
921
- def test_sort_values_frame (self , data_for_sorting , ascending , request ):
922
- pa_dtype = data_for_sorting .dtype .pyarrow_dtype
923
- with tm .maybe_produces_warning (
924
- PerformanceWarning ,
925
- pa_version_under7p0 and not pa .types .is_duration (pa_dtype ),
926
- check_stacklevel = False ,
927
- ):
928
- super ().test_sort_values_frame (data_for_sorting , ascending )
929
-
930
847
def test_factorize (self , data_for_grouping , request ):
931
848
pa_dtype = data_for_grouping .dtype .pyarrow_dtype
932
849
if pa .types .is_boolean (pa_dtype ):
0 commit comments