8000 Make np.ma.take works on scalars by eric-wieser · Pull Request #7586 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Make np.ma.take works on scalars #7586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
TST: Verify np.ma.take works on scalars
See #7585
  • Loading branch information
eric-wieser committed Apr 29, 2016
commit 6e5aa5e6b7980021ba5de67c872fad70dd4f9c92
4 changes: 4 additions & 0 deletions numpy/ma/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2998,6 +2998,10 @@ def test_take(self):
assert_equal(x.take([[0, 1], [0, 1]]),
masked_array([[10, 20], [10, 20]], [[0, 1], [0, 1]]))

# assert_equal crashes when passed np.ma.mask
Copy link
Member Author

Choose a reason for hiding this comment

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

This raises the question of whether any of these tests are actually verifying things, since assert_equal will ignore the mask

self.assertIs(x[1], np.ma.masked)
self.assertIs(x.take(1), np.ma.masked)

x = array([[10, 20, 30], [40, 50, 60]], mask=[[0, 0, 1], [1, 0, 0, ]])
assert_equal(x.take([0, 2], axis=1),
array([[10, 30], [40, 60]], mask=[[0, 1], [1, 0]]))
Expand Down
0