@@ -17,7 +17,8 @@ def test_unique(index_or_series_obj):
1717 obj = np .repeat (obj , range (1 , len (obj ) + 1 ))
1818 with tm .maybe_produces_warning (
1919 PerformanceWarning ,
20- pa_version_under2p0 and str (index_or_series_obj .dtype ) == "string[pyarrow]" ,
20+ pa_version_under2p0
21+ and getattr (index_or_series_obj .dtype , "storage" , "" ) == "pyarrow" ,
2122 ):
2223 result = obj .unique ()
2324
@@ -59,7 +60,8 @@ def test_unique_null(null_obj, index_or_series_obj):
5960 obj = klass (repeated_values , dtype = obj .dtype )
6061 with tm .maybe_produces_warning (
6162 PerformanceWarning ,
62- pa_version_under2p0 and str (index_or_series_obj .dtype ) == "string[pyarrow]" ,
63+ pa_version_under2p0
64+ and getattr (index_or_series_obj .dtype , "storage" , "" ) == "pyarrow" ,
6365 ):
6466 result = obj .unique ()
6567
@@ -88,10 +90,11 @@ def test_nunique(index_or_series_obj):
8890 obj = np .repeat (obj , range (1 , len (obj ) + 1 ))
8991 with tm .maybe_produces_warning (
9092 PerformanceWarning ,
91- pa_version_under2p0 and str (index_or_series_obj .dtype ) == "string[pyarrow]" ,
93+ pa_version_under2p0
94+ and getattr (index_or_series_obj .dtype , "storage" , "" ) == "pyarrow" ,
9295 ):
9396 expected = len (obj .unique ())
94- assert obj .nunique (dropna = False ) == expected
97+ assert obj .nunique (dropna = False ) == expected
9598
9699
97100@pytest .mark .parametrize ("null_obj" , [np .nan , None ])
@@ -116,17 +119,20 @@ def test_nunique_null(null_obj, index_or_series_obj):
116119 else :
117120 with tm .maybe_produces_warning (
118121 PerformanceWarning ,
119- pa_version_under2p0 and str (index_or_series_obj .dtype ) == "string[pyarrow]" ,
122+ pa_version_under2p0
123+ and getattr (index_or_series_obj .dtype , "storage" , "" ) == "pyarrow" ,
120124 ):
121125 num_unique_values = len (obj .unique ())
122126 with tm .maybe_produces_warning (
123127 PerformanceWarning ,
124- pa_version_under2p0 and str (index_or_series_obj .dtype ) == "string[pyarrow]" ,
128+ pa_version_under2p0
129+ and getattr (index_or_series_obj .dtype , "storage" , "" ) == "pyarrow" ,
125130 ):
126131 assert obj .nunique () == max (0 , num_unique_values - 1 )
127132 with tm .maybe_produces_warning (
128133 PerformanceWarning ,
129- pa_version_under2p0 and str (index_or_series_obj .dtype ) == "string[pyarrow]" ,
134+ pa_version_under2p0
135+ and getattr (index_or_series_obj .dtype , "storage" , "" ) == "pyarrow" ,
130136 ):
131137 assert obj .nunique (dropna = False ) == max (0 , num_unique_values )
132138
0 commit comments