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

Incorrect getitem test?

Open
#172 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
testing-qa

Research direction

Start with the test_getitem property and reproduce the reported case using shape=(1,), dtype=numpy.float32, data=-0.0, and key=(0,). Determine whether the assertion incorrectly treats -0.0 as unequal to 0.0; done means the test behavior is corrected or the failure is shown to be valid.

Written by the indexing model from the issue text.

Description

bug

cupy fails test_getitem with:

E                       AssertionError: out=-0.0, should be 0.0 [__getitem__()]
E                       Falsifying example: test_getitem(
E                           shape=(1,), dtype=numpy.float32, data=data(...),
E                       )
E                       Draw 1 (obj): [-0.0]
E                       x=array([-0.], dtype=float32)
E                       Draw 2 (key): (0,)

It seems like it is saying that asarray([-0.0])[0,] should be 0.0 instead of -0.0. CuPy appears to be correct:

>>> import cupy as cp
>>> cp.array([-0.0], dtype=cp.float32)[0,]
array(-0., dtype=float32)

It's possible I'm misinterpreting the test. The output of the tests when there are data().draw()s isn't always very readable.

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.