Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Avoid inplace operators in general tests

Open
#287 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
numpy, python
Domain
testing

Research direction

Start at array_api_tests/pytest_helpers.py around line 483 and inspect the generic test that uses an inplace operator. Reproduce the scalar behavior shown in the issue, then run the affected general tests. Done means NumPy scalar implementations no longer fail there while the relevant array API tests still pass.

Written by the indexing model from the issue text.

Description

low priority

numpy returns scalars instead of 0d arrays:

import numpy as np
import array_api_strict as xps

xps.mean(xps.asarray(4, dtype=xps.float32)).__iadd__(1)
np.mean(np.asarray(4, dtype=np.float32)).__iadd__(1)  # AttributeError: 'numpy.float32' object has no attribute '__iadd__'

And this causes errors in unrelated tests since inplace operators are used in more generic tests:
https://github.com/data-apis/array-api-tests/blob/4caff2867c69d5b9b329320319b61c5444bf6f87/array_api_tests/pytest_helpers.py#L483

I don't think using inplace-operators in this case is particularly important and can probably be switched to a normal bitwise or.

xref: https://github.com/numpy/numpy/issues/27305

Dominant language
Python
Stars
74
Forks
54
Avg merge
4h 35m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from data-apis/array-api-tests

All issues in data-apis/array-api-tests

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.