From ab04d0cd6bb7b6dce80ee7bc8ad5541c2578b174 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Fri, 13 Nov 2026 10:49:19 +0000 Subject: [PATCH] GH-55486: [Python] Make test_asarray run and update it to the current Scalar API test_asarray is marked both pandas and nopandas. Exactly one of those groups is enabled in any run, so the test is always skipped. Its body has gone stale meanwhile: it uses the removed Int64Value alias and compares Scalars with Python ints. Replace the two marks with the numpy mark, so the test runs with and without pandas, and update the body to the current Scalar API. Checked on x86-64 against the 26.0.1 wheel: the old body fails at the tolist() assertion, the new test passes. --- python/pyarrow/tests/test_array.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 63c0eb0bea4e..c95ff9135352 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -316,18 +316,19 @@ def test_to_pandas_zero_copy(): series.sum() -@pytest.mark.nopandas -@pytest.mark.pandas +@pytest.mark.numpy def test_asarray(): - # ensure this is tested both when pandas is present or not (ARROW-6564) + # no pandas mark: this must run both when pandas is present and when it + # is not (ARROW-6564) arr = pa.array(range(4)) - # The iterator interface gives back an array of Int64Value's + # Iteration gives Scalar objects, preserved by NumPy's object array. np_arr = np.asarray([_ for _ in arr]) - assert np_arr.tolist() == [0, 1, 2, 3] + assert np_arr.tolist() == list(arr) + assert [value.as_py() for value in np_arr] == [0, 1, 2, 3] assert np_arr.dtype == np.dtype('O') - assert isinstance(np_arr[0], pa.lib.Int64Value) + assert isinstance(np_arr[0], pa.Int64Scalar) # Calling with the arrow array gives back an array with 'int64' dtype np_arr = np.asarray(arr)