numpy / numpy/numpy

BUG: assert_array_almost_equal fails to compare array with masked array

Open
#14,624 7 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

05 - Testing 15 - Discussion component: numpy.ma
Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

Reproducing code example:

The following code sample passes, but is expected to fail:

from numpy.testing import assert_array_almost_equal
assert_array_almost_equal(np.array([10, 20]), np.ma.array([10, np.nan], mask=[False, True]), 2)
Numpy/Python version information:

python 3.7.3
numpy 1.17.2

Contributor guide

Open the contributing guide

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.

Research direction

Start by running the provided Python reproducer and tracing the assert_array_almost_equal entry point in NumPy's testing code. Identify the existing tests for array and masked-array comparisons, then add regression coverage so this case fails as expected under the documented comparison behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.