@@ -270,35 +270,6 @@ def data_for_twos(data):
270270 # TODO: skip otherwise?
271271
272272
273- @pytest .fixture
274- def arrow_to_numpy_tracker (monkeypatch ):
275- """
276- Fixture to track if ArrowExtensionArray.to_numpy() was called.
277-
278- Returns a callable that returns True if to_numpy was called since the last check,
279- and resets the tracker.
280- """
281- from pandas .core .arrays .arrow import ArrowExtensionArray
282-
283- called = False
284- original_to_numpy = ArrowExtensionArray .to_numpy
285-
286- def tracked_to_numpy (self , * args , ** kwargs ):
287- nonlocal called
288- called = True
289- return original_to_numpy (self , * args , ** kwargs )
290-
291- monkeypatch .setattr (ArrowExtensionArray , "to_numpy" , tracked_to_numpy )
292-
293- def was_called ():
294- nonlocal called
295- result = called
296- called = False
297- return result
298-
299- return was_called
300-
301-
302273class TestArrowArray (base .ExtensionTests ):
303274 def _construct_for_combine_add (self , left , right ):
304275 dtype = left .dtype
@@ -816,19 +787,6 @@ def test_value_counts_returns_pyarrow_int64(self, data):
816787 result = data .value_counts ()
817788 assert result .dtype == ArrowDtype (pa .int64 ())
818789
819- @pytest .mark .parametrize ("normalize" , [False , True ])
820- def test_value_counts_no_numpy_fallback (
821- self , data , normalize , arrow_to_numpy_tracker
822- ):
823- # Ensure value_counts doesn't unnecessarily convert Arrow arrays to NumPy
824- data = data [:10 ]
825- ser = pd .Series (data )
826-
827- ser .value_counts (normalize = normalize )
828-
829- numpy_called = arrow_to_numpy_tracker ()
830- assert not numpy_called
831-
832790 _combine_le_expected_dtype = "bool[pyarrow]"
833791
834792 def get_op_from_name (self , op_name ):
0 commit comments