Skip to content

GH-55486: [Python] Make test_asarray run and update it to the current Scalar API - #55585

Merged
tadeja merged 1 commit into
apache:mainfrom
AFOliveira:riscv/arrow
Dec 2, 2026
Merged

tadeja merged 1 commit into
apache:mainfrom
AFOliveira:riscv/arrow

Conversation

@AFOliveira

@AFOliveira AFOliveira commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

test_asarray and test_chunked_array_asarray are marked both pandas and nopandas. Exactly one of those groups is enabled in any run, so both tests are always skipped. test_asarray body has gone stale meanwhile: it uses the removed Int64Value alias and compares Scalars with Python ints. (Edit: replacing Int64Value -> Int64Scalar already done in #55264)

What changes are included in this PR?

  • Replace pandas and nopandas marks with @pytest.mark.numpy, so the tests run with and without pandas. On both test_asarray and test_chunked_array_asarray.
  • Update the body to the current Scalar API (as_py()).

Are these changes tested?

The change is to a test. On x86-64 against the 26.0.1 wheel, the old body fails at the tolist() assertion and the new test passes.
Edit: Rebased after #55264 merged. Also CI tests pass now.

Are there any user-facing changes?

No.

Was AI used for this PR?

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55486 has been automatically assigned in GitHub to PR creator.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55486 has been automatically assigned in GitHub to PR creator.

Comment thread python/pyarrow/tests/test_array.py Resolved

@tadeja tadeja left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @AFOliveira!
Just found we have the same problem for another test and it'd be good to resolve it with this PR as well. Could you add a similar change there?

diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py
@@ -420,10 +420,10 @@ def test_to_pandas_empty_table():
     tm.assert_frame_equal(result, df.iloc[:0])
 
 
-@pytest.mark.pandas
-@pytest.mark.nopandas
+@pytest.mark.numpy
 def test_chunked_array_asarray():
-    # ensure this is tested both when pandas is present or not (ARROW-6564)
+    # no pandas mark: ...

@tadeja

tadeja commented Dec 1, 2026

Copy link
Copy Markdown
Member

@AFOliveira do you wish to continue this PR and could you rebase and apply my suggestion? Otherwise, I'd go ahead with that tomorrow.

…urrent Scalar API

Use the NumPy marker for test_asarray and test_chunked_array_asarray so
both tests run with or without pandas. Convert the Arrow scalars with
as_py() before comparing them to Python integers.
@AFOliveira

Copy link
Copy Markdown
Contributor Author

Fixed, thanks for your time!

@AFOliveira
AFOliveira requested a review from tadeja December 2, 2026 10:08
@tadeja

tadeja commented Dec 2, 2026

Copy link
Copy Markdown
Member

@AFOliveira that's great. I've edited PR description a bit, merging now. Please also comment on the issue #55486 so ti can be assigned to you.

@tadeja
tadeja merged commit 52d252f into apache:main Dec 2, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python] test_asarray and test_chunked_array_asarray never run due to mark pandas+nopandas

2 participants