8000 Fix recfunctions.join_by bugs (issue #4216) by gabobert · Pull Request #4524 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@gabobert
Copy link

This fixes the issue: "BUG: recfunctions.join_by fails if the keys are not in the same order #4216" and another bug.

@charris
Copy link
Member
charris commented Mar 23, 2014

@gabobert Universal test failure

FAIL: test_two_keys_two_vars (test_recfunctions.TestJoinBy2)

----------------------------------------------------------------------

Traceback (most recent call last):

File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/numpy/lib/tests/test_recfunctions.py", line 679, in test_two_keys_two_vars

assert_equal(test.dtype, control.dtype)

File "/home/travis/virtualenv/python2.6/lib/python2.6/site-packages/numpy/ma/testutils.py", line 100, in assert_equal

raise AssertionError(msg)

AssertionError:

Items are not equal:

ACTUAL: dtype([('a', '<i8'), ('k', '<i8'), ('b1', '<i8'), ('b2', '<i8'), ('c1', '<i8'), ('c2', '<i8')])

DESIRED: dtype([('k', '<i8'), ('a', '<i8'), ('b1', '<i8'), ('b2', '<i8'), ('c1', '<i8'), ('c2', '<i8')])

@gabobert
Copy link
Author

Now that joining two arrays with differently ordered key-fields is supported, the order of the key-fields in the returned array should match the key argument of join_by in my opinion. So the test should be changed to reflect this.

@charris
Copy link
Member
charris commented Mar 24, 2014

@gabobert Then you should change the test to match what it should return ;) It would be a g 8000 ood idea to post this change to the list for discussion.

@charris
Copy link
Member
charris commented Jan 9, 2016

#4216 is still open, but seems to have been fixed somewhere along the line. @ahaldane Comment?

@ahaldane
Copy link
Member

I just tested, and #4216 was fixed by #5480. Specifically, that PR allows casting between structured types with differently ordered fields, which fixes #4216. I'll go ahead and close that issue and this PR.

Also, pinging myself in #6053 to think about this case. (I rework behavior of re-ordered fields there).

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.

4 participants

0