arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[Python] test_asarray never runs due to conflicting mark pandas+nopandas

Open tadeja opened this issue 3 weeks ago • 1 comments

Describe the bug, including details regarding any error messages, version, and platform.

pyarrow/tests/test_array.py::test_asarray is decorated with both:

https://github.com/apache/arrow/blob/498526185c0fe97a915be7cac989f05786fdb9ea/python/pyarrow/tests/test_array.py#L319-L321

So the test never runs. Discovered in https://github.com/apache/arrow/pull/55264#discussion_r4483031111

Component(s)

Python

tadeja avatar Nov 10 '26 22:11 tadeja

Removing the marks alone isn't enough, because the body is stale and fails once it runs. I copied the test body out without the marks and ran it against the released wheel (pyarrow 26.0.1, numpy 2.4.6, pandas 3.1.1), not a build of main. The first block fails:

E       assert [<pyarrow.Int...t64Scalar: 3>] == [0, 1, 2, 3]
E         At index 0 diff: <pyarrow.Int64Scalar: 0> != 0

Iterating the array yields Int64Scalar objects, so np.asarray([_ for _ in arr]).tolist() returns scalars, not ints. With that assertion changed to [x.as_py() for x in np_arr] == [0, 1, 2, 3] and the isinstance check changed to pa.Int64Scalar, the test passes. The rest of the body passes unchanged.

#55264 edits the same lines (Int64Value to Int64Scalar) but keeps the tolist() assertion, so that line would still fail once the marks are fixed. I haven't opened a separate PR because it would overlap with #55264. If you'd rather review it on its own, I can send one with the marker fix too (drop pandas/nopandas, add numpy).

09Catho avatar Nov 11 '26 03:11 09Catho