diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-07-01 20:03:03 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-07-01 20:03:03 +0100 |
commit | 34855a5fce47528d481ff2c89f77708542aa39a3 (patch) | |
tree | 4cdf2f86be4b366fc3ee69d211929bb7fce2a72a /numpy/lib/tests/test_recfunctions.py | |
parent | 1c76fed4aa3cbead721b90bef6ccbefbcc61dbd2 (diff) | |
download | numpy-34855a5fce47528d481ff2c89f77708542aa39a3.tar.gz |
TST: join_by now works for dtypes with padding too
Once again, thanks to not using .descr
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r-- | numpy/lib/tests/test_recfunctions.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index 36635ec43..7cf93d67f 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -727,6 +727,22 @@ class TestJoinBy(TestCase): assert_equal(res.dtype, expected_dtype) assert_equal(res, expected) + def test_padded_dtype(self): + dt = np.dtype('i1,f4', align=True) + dt.names = ('k', 'v') + assert_(len(dt.descr), 3) # padding field is inserted + + a = np.array([(1, 3), (3, 2)], dt) + b = np.array([(1, 1), (2, 2)], dt) + res = join_by('k', a, b) + + # no padding fields remain + expected_dtype = np.dtype([ + ('k', 'i1'), ('v1', 'f4'), ('v2', 'f4') + ]) + + assert_equal(res.dtype, expected_dtype) + class TestJoinBy2(TestCase): @classmethod |